Mercurial > mm7
annotate GUI/UI/UIPopup.cpp @ 2547:fed97f15d1e1
* SaveLoad
* QuickReference
* Modal
* Character
author | a.parshin |
---|---|
date | Tue, 12 May 2015 01:45:31 +0200 |
parents | c674d547cc7c |
children | 87e5590d034b |
rev | line source |
---|---|
2501 | 1 #define _CRTDBG_MAP_ALLOC |
2 #include <stdlib.h> | |
3 #include <crtdbg.h> | |
4 | |
5 #define _CRT_SECURE_NO_WARNINGS | |
2541 | 6 |
7 #include "Engine/Engine.h" | |
8 | |
2501 | 9 #include "UIPopup.h" |
10 #include "Books\UIMapBook.h" | |
11 #include "UIShops.h" | |
12 | |
2502 | 13 #include "..\../IO/Mouse.h" |
2501 | 14 |
15 #include "..\../Engine/Graphics/Sprites.h" | |
16 #include "..\../Engine/Graphics/Vis.h" | |
2502 | 17 #include "..\../GUI/GUIWindow.h" |
18 #include "..\../GUI/GUIFont.h" | |
2501 | 19 #include "..\../Engine/Party.h" |
2502 | 20 #include "..\../Media/Audio/AudioPlayer.h" |
2501 | 21 #include "..\../Engine/LOD.h" |
22 #include "..\../Engine/Objects/Actor.h" | |
23 #include "..\../Engine/Graphics/Viewport.h" | |
24 #include "..\../Engine/Objects/SpriteObject.h" | |
25 #include "..\../Engine/Objects/ObjectList.h" | |
26 #include "..\../Engine/Objects/Chest.h" | |
27 #include "..\../Engine/Graphics/PaletteManager.h" | |
28 #include "..\../Engine/Timer.h" | |
29 #include "..\../Engine/texts.h" | |
30 #include "..\../Engine/Events.h" | |
31 | |
32 static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually | |
33 | |
34 | |
35 //----- (004179BC) -------------------------------------------------------- | |
36 void CharacterUI_DrawTooltip(const char *Title, const char *content) | |
37 { | |
38 GUIWindow popup_window; // [sp+Ch] [bp-5Ch]@1 | |
39 POINT v6; // [sp+60h] [bp-8h]@1 | |
40 | |
41 memset(&popup_window, 0, 0x54u); | |
42 popup_window.uFrameWidth = 384; | |
43 popup_window.uFrameHeight = 256; | |
44 popup_window.uFrameX = 128; | |
45 popup_window.uFrameY = pMouse->GetCursorPos(&v6)->y + 30; | |
46 popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(content, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; | |
47 popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; | |
48 popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; | |
49 popup_window.DrawMessageBox(0); | |
50 | |
51 popup_window.uFrameX += 12; | |
52 popup_window.uFrameWidth -= 24; | |
53 popup_window.uFrameY += 12; | |
54 popup_window.uFrameHeight -= 12; | |
55 popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; | |
56 popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; | |
57 sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", ui_character_tooltip_header_default_color, Title); | |
58 popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); | |
59 popup_window.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, content, 0, 0, 0); | |
60 } | |
61 | |
62 //----- (004151D9) -------------------------------------------------------- | |
63 void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight) | |
64 { | |
65 unsigned int uNumTiles; // [sp+2Ch] [bp-Ch]@6 | |
66 unsigned int coord_x; // [sp+2Ch] [bp-Ch]@3 | |
67 unsigned int coord_y; // [sp+34h] [bp-4h]@5 | |
68 | |
2524 | 69 auto parchment = pIcons_LOD->GetTexture(uTextureID_Parchment); |
70 | |
71 if ( parchment->uTextureWidth && parchment->uTextureHeight) | |
2501 | 72 { |
2524 | 73 pRenderer->SetUIClipRect(uX, uY, uX + uWidth, uY + uHeight); |
74 | |
75 uNumTiles = uWidth / parchment->uTextureWidth; | |
76 if ( uWidth % parchment->uTextureWidth ) | |
2501 | 77 ++uNumTiles; |
78 coord_y = uY; | |
2524 | 79 for ( uint j = 0; j <= uHeight / parchment->uTextureHeight; j++ ) |
2501 | 80 { |
2524 | 81 coord_x = uX - parchment->uTextureWidth; |
2501 | 82 for ( uint i = uNumTiles + 1; i; --i ) |
83 { | |
2524 | 84 coord_x += parchment->uTextureWidth; |
85 pRenderer->DrawTextureIndexed(coord_x, coord_y, parchment); | |
2501 | 86 } |
2524 | 87 coord_y += parchment->uTextureHeight; |
2501 | 88 } |
2524 | 89 pRenderer->DrawTextureIndexedAlpha(uX, uY, pIcons_LOD->GetTexture(uTextureID_5076AC)); |
90 pRenderer->DrawTextureIndexedAlpha(uX, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B4)); | |
91 pRenderer->DrawTextureIndexedAlpha(uX + uWidth - 32, uY, pIcons_LOD->GetTexture(uTextureID_5076A8)); | |
92 pRenderer->DrawTextureIndexedAlpha(uX + uWidth - 32, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B0)); | |
2501 | 93 if ( uWidth > 64 ) |
94 { | |
2524 | 95 pRenderer->SetUIClipRect(uX + 32, uY, uX + uWidth - 32, uY + uHeight); |
96 pRenderer->DrawTextureIndexedAlpha(uX + 32, uY, pIcons_LOD->GetTexture(uTextureID_507698)); | |
97 pRenderer->DrawTextureIndexedAlpha(uX + 32, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4)); | |
2501 | 98 if ( uWidth > 512 ) |
99 { | |
2524 | 100 pRenderer->DrawTextureIndexedAlpha(uX + 544, uY, pIcons_LOD->GetTexture(uTextureID_507698)); |
101 pRenderer->DrawTextureIndexedAlpha(uX + 544, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4)); | |
2501 | 102 } |
103 } | |
104 if ( uHeight > 64 ) | |
105 { | |
2524 | 106 pRenderer->SetUIClipRect(uX, uY + 32, uX + uWidth, uY + uHeight - 32); |
107 pRenderer->DrawTextureIndexedAlpha(uX, uY + 32, pIcons_LOD->GetTexture(uTextureID_5076A0)); | |
108 pRenderer->DrawTextureIndexedAlpha(uX + uWidth - 10, uY + 32, pIcons_LOD->GetTexture(uTextureID_50769C)); | |
2501 | 109 } |
2524 | 110 pRenderer->ResetUIClipRect(); |
2501 | 111 } |
112 } | |
113 | |
114 //----- (0041D895) -------------------------------------------------------- | |
115 void GameUI_DrawItemInfo( struct ItemGen* inspect_item ) | |
116 { | |
117 unsigned int v2; // eax@3 | |
118 const char *v28; // edi@69 | |
119 int v34; // esi@81 | |
120 const char *pText; // [sp-14h] [bp-28Ch]@110 | |
121 char out_text[300]; // [sp+8h] [bp-270h]@40 | |
122 char v65[120]; // [sp+134h] [bp-144h]@92 | |
123 stru351_summoned_item v67; | |
124 int v77; // [sp+200h] [bp-78h]@12 | |
125 int v78; // [sp+204h] [bp-74h]@5 | |
126 GUIWindow iteminfo_window; // [sp+208h] [bp-70h]@2 | |
127 POINT a2; // [sp+25Ch] [bp-1Ch]@2 | |
128 int v81; // [sp+264h] [bp-14h]@5 | |
129 PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18 | |
130 char* v84; | |
131 int v85; | |
132 char *Str; // [sp+270h] [bp-8h]@65 | |
133 | |
134 int r_mask = 0xF800; | |
135 int g_mask = 0x7E0; | |
136 int b_mask = 0x1F; | |
137 | |
138 if (!inspect_item->uItemID) | |
139 return; | |
140 iteminfo_window.Hint = nullptr; | |
141 iteminfo_window.uFrameWidth = 384; | |
142 iteminfo_window.uFrameHeight = 180; | |
143 iteminfo_window.uFrameY = 40; | |
144 if ( pMouse->GetCursorPos(&a2)->x <= 320 ) | |
145 v2 = pMouse->GetCursorPos(&a2)->x + 30; | |
146 else | |
147 v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30; | |
148 iteminfo_window.uFrameX = v2; | |
149 v78 = 100 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureWidth; | |
150 v81 = 144 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight; | |
151 if ( v78 > 0 ) | |
152 v78 = v78 / 2; | |
153 if ( v81 <= 0 ) | |
154 v81 = 0; | |
155 else | |
156 v81 = v81 / 2; | |
157 if ( !pItemsTable->pItems[inspect_item->uItemID].uItemID_Rep_St ) | |
158 inspect_item->SetIdentified(); | |
159 v77 = 0; | |
160 if (inspect_item->GetItemEquipType() == EQUIP_GOLD) | |
161 v77 = inspect_item->uSpecEnchantmentType; | |
162 if ( uActiveCharacter ) | |
163 { | |
164 //try to identify | |
165 if (!inspect_item->IsIdentified()) | |
166 { | |
167 if ( pPlayers[uActiveCharacter]->CanIdentify(inspect_item) == 1 ) | |
168 inspect_item->SetIdentified(); | |
169 v83 = SPEECH_9; | |
170 if ( !inspect_item->IsIdentified() ) | |
171 ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2);//"Identify Failed" | |
172 else | |
173 { | |
174 v83 = SPEECH_8; | |
175 if ( inspect_item->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) ) | |
176 v83 = SPEECH_7; | |
177 } | |
178 if ( dword_4E455C ) | |
179 { | |
180 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0); | |
181 dword_4E455C = 0; | |
182 } | |
183 } | |
184 inspect_item->UpdateTempBonus(pParty->uTimePlayed); | |
185 if (inspect_item->IsBroken()) | |
186 { | |
187 if ( pPlayers[uActiveCharacter]->CanRepair(inspect_item) == 1 ) | |
188 inspect_item->uAttributes = inspect_item->uAttributes & 0xFFFFFFFD | 1; | |
189 v83 = SPEECH_11; | |
190 if ( !inspect_item->IsBroken() ) | |
191 v83 = SPEECH_10; | |
192 else | |
193 ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2);//"Repair Failed" | |
194 if ( dword_4E455C ) | |
195 { | |
196 pPlayers[uActiveCharacter]->PlaySound(v83, 0); | |
197 dword_4E455C = 0; | |
198 } | |
199 } | |
200 } | |
201 if (inspect_item->IsBroken()) | |
202 { | |
203 iteminfo_window.DrawMessageBox(0); | |
2524 | 204 pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, |
2501 | 205 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, |
206 iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); | |
207 iteminfo_window.uFrameWidth -= 24; | |
208 iteminfo_window.uFrameHeight -= 12; | |
209 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; | |
210 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; | |
211 pRenderer->DrawTransparentRedShade(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); | |
212 if ( inspect_item->IsIdentified()) | |
213 pText = (char *)inspect_item->GetIdentifiedName(); | |
214 else | |
215 pText = pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName; | |
216 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pText, 3); | |
217 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2, | |
218 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item" | |
2524 | 219 pRenderer->ResetUIClipRect(); |
2501 | 220 if ( !areWeLoadingTexture ) |
221 { | |
222 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); | |
223 pIcons_LOD->SyncLoadedFilesCount(); | |
224 } | |
225 return; | |
226 } | |
227 if (!inspect_item->IsIdentified()) | |
228 { | |
229 iteminfo_window.DrawMessageBox(0); | |
2524 | 230 pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, |
2501 | 231 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); |
232 iteminfo_window.uFrameWidth -= 24; | |
233 iteminfo_window.uFrameHeight -= 12; | |
234 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; | |
235 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; | |
2524 | 236 pRenderer->DrawTextureIndexedAlpha(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); |
2501 | 237 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3); |
238 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2, | |
239 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified" | |
2524 | 240 pRenderer->ResetUIClipRect(); |
2501 | 241 if ( !areWeLoadingTexture ) |
242 { | |
243 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); | |
244 pIcons_LOD->SyncLoadedFilesCount(); | |
245 } | |
246 return; | |
247 } | |
248 sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName); //"Type: %s" | |
249 out_text[100] = 0; | |
250 out_text[200] = 0; | |
251 switch (inspect_item->GetItemEquipType()) | |
252 { | |
253 case EQUIP_SINGLE_HANDED: | |
254 case EQUIP_TWO_HANDED: | |
255 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK], | |
256 (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], | |
257 (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); //"Damage" | |
258 if (inspect_item->GetDamageMod()) | |
259 { | |
260 char mod[16]; | |
261 sprintf(mod, "+%d", (int)inspect_item->GetDamageMod()); | |
262 strcat(out_text + 100, mod); | |
263 } | |
264 break; | |
265 | |
266 case EQUIP_BOW: | |
267 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot" | |
268 (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], //"Damage" | |
269 (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); | |
270 if (inspect_item->GetDamageMod()) | |
271 { | |
272 char mod[16]; | |
273 sprintf(mod, "+%d", (int)inspect_item->GetDamageMod()); | |
274 strcat(out_text + 100, mod); | |
275 } | |
276 break; | |
277 | |
278 case EQUIP_ARMOUR: | |
279 case EQUIP_SHIELD: | |
280 case EQUIP_HELMET: | |
281 case EQUIP_BELT: | |
282 case EQUIP_CLOAK: | |
283 case EQUIP_GAUNTLETS: | |
284 case EQUIP_BOOTS: | |
285 case EQUIP_RING: | |
286 case EQUIP_AMULET: | |
287 if (inspect_item->GetDamageDice()) //"Armor" | |
288 sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], | |
289 inspect_item->GetDamageDice() + inspect_item->GetDamageMod()); | |
290 break; | |
291 } | |
292 | |
293 if ( !v77 ) | |
294 { | |
295 if (inspect_item->GetItemEquipType() ==EQUIP_POTION) //this is CORRECT! do not move to switch! | |
296 { | |
297 if ( inspect_item->uEnchantmentType ) | |
298 sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power" | |
299 } | |
300 else if (inspect_item->GetItemEquipType() == EQUIP_REAGENT) | |
301 sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], inspect_item->GetDamageDice()); //"Power" | |
302 else if ( inspect_item->uEnchantmentType ) | |
303 sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->m_enchantmentStrength); //"Special" | |
304 else if ( inspect_item->uSpecEnchantmentType ) | |
305 sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement); | |
306 else if ( inspect_item->uNumCharges ) | |
307 sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges" | |
308 } | |
309 iteminfo_window.uFrameWidth -= 12; | |
310 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; | |
311 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; | |
312 Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8)); | |
313 v84 = &out_text[0]; | |
314 for ( uint i = 1; i <= 3; i++ ) | |
315 { | |
316 if ( *v84 ) | |
317 Str += pFontComic->CalcTextHeight(v84, &iteminfo_window, 100, 0) + 3; | |
318 v84 += 100; | |
319 } | |
320 v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription; | |
321 if ( *v28 ) | |
322 Str += pFontSmallnum->CalcTextHeight(pItemsTable->pItems[inspect_item->uItemID].pDescription, &iteminfo_window, 100, 0); | |
323 iteminfo_window.uFrameHeight = pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), | |
324 TEXTURE_16BIT_PALETTE)->uTextureHeight + v81 + 54; | |
325 if ( (signed int)Str > (signed int)iteminfo_window.uFrameHeight ) | |
326 iteminfo_window.uFrameHeight = (unsigned int)Str; | |
327 if ( inspect_item->uAttributes & ITEM_TEMP_BONUS && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) ) | |
328 iteminfo_window.uFrameHeight += LOBYTE(pFontComic->uFontHeight); | |
329 v85 = 0; | |
330 if ( pFontArrus->uFontHeight ) | |
331 { | |
332 iteminfo_window.uFrameWidth -= 24; | |
333 if ( pFontArrus->CalcTextHeight(inspect_item->GetIdentifiedName(), &iteminfo_window, 0, 0) / (signed int)pFontArrus->uFontHeight ) | |
334 v85 = pFontArrus->uFontHeight; | |
335 iteminfo_window.uFrameWidth += 24; | |
336 } | |
337 iteminfo_window.uFrameWidth += 12; | |
338 iteminfo_window.uFrameHeight += (unsigned int)v85; | |
339 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; | |
340 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; | |
341 iteminfo_window.DrawMessageBox(0); | |
2524 | 342 pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, |
2501 | 343 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); |
344 iteminfo_window.uFrameWidth -= 12; | |
345 iteminfo_window.uFrameHeight -= 12; | |
346 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; | |
347 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; | |
2524 | 348 pRenderer->DrawTextureIndexedAlpha(iteminfo_window.uFrameX + v78, |
2501 | 349 iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2, |
350 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); | |
351 | |
352 v34 = (int)(v85 + 35); | |
353 Str = out_text; | |
354 for ( uint i = 1; i <= 3; i++ ) | |
355 { | |
356 if ( *Str ) | |
357 { | |
358 iteminfo_window.DrawText(pFontComic, 100, v34, 0, Str, 0, 0, 0); | |
359 v34 += pFontComic->CalcTextHeight(Str, &iteminfo_window, 100, 0) + 3; | |
360 } | |
361 Str += 100; | |
362 } | |
363 v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription; | |
364 if ( *v28 ) | |
365 iteminfo_window.DrawText(pFontSmallnum, 100, v34, 0, v28, 0, 0, 0); | |
366 iteminfo_window.uFrameX += 12; | |
367 iteminfo_window.uFrameWidth -= 24; | |
368 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), inspect_item->GetIdentifiedName(), 3); | |
369 iteminfo_window.uFrameWidth += 24; | |
370 iteminfo_window.uFrameX -= 12; | |
371 if ( v77 ) | |
372 { | |
373 sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value" | |
374 iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); | |
2524 | 375 pRenderer->ResetUIClipRect(); |
2501 | 376 } |
377 else | |
378 { | |
379 if ( (inspect_item->uAttributes & ITEM_TEMP_BONUS) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) ) | |
380 { | |
381 init_summoned_item(&v67, inspect_item->uExpireTime - pParty->uTimePlayed); | |
382 strcpy(pTmpBuf.data(), "Duration:"); | |
383 Str = (char *)(v67.field_18_expire_year - game_starting_year); | |
384 if (v67.field_18_expire_year != 1168 ) | |
385 { | |
386 sprintf(v65, " %d:yr", v67.field_18_expire_year - game_starting_year); | |
387 strcat(pTmpBuf.data(), v65); | |
388 } | |
389 if ( (((v67.field_14_exprie_month || Str) && | |
390 ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str) | |
391 || v67.field_C_expire_day) | |
392 && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || | |
393 v67.field_C_expire_day) | |
394 || v67.field_8_expire_hour) | |
395 && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || | |
396 v67.field_C_expire_day || v67.field_8_expire_hour) | |
397 || v67.field_4_expire_minute ) | |
398 { | |
399 sprintf(v65, " %d:mn", v67.field_4_expire_minute); | |
400 strcat(pTmpBuf.data(), v65); | |
401 } | |
402 iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - 2 * LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); | |
403 } | |
404 sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], inspect_item->GetValue()); | |
405 iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); | |
406 if ( inspect_item->uAttributes & ITEM_STOLEN ) | |
407 pText = pGlobalTXT_LocalizationStrings[187]; //"Stolen" | |
408 else | |
409 { | |
410 if ( !(inspect_item->uAttributes & ITEM_HARDENED) ) | |
411 { | |
2524 | 412 pRenderer->ResetUIClipRect(); |
2501 | 413 if ( !areWeLoadingTexture ) |
414 { | |
415 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); | |
416 pIcons_LOD->SyncLoadedFilesCount(); | |
417 } | |
418 return; | |
419 } | |
420 pText = pGlobalTXT_LocalizationStrings[651]; //"Hardened" | |
421 } | |
422 LOWORD(inspect_item->uAttributes) = r_mask; | |
423 iteminfo_window.DrawText(pFontComic, pFontComic->GetLineWidth(pTmpBuf.data()) + 132, | |
424 iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), inspect_item->uAttributes, pText, 0, 0, 0); | |
2524 | 425 pRenderer->ResetUIClipRect(); |
2501 | 426 } |
427 if ( !areWeLoadingTexture ) | |
428 { | |
429 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); | |
430 pIcons_LOD->SyncLoadedFilesCount(); | |
431 } | |
432 return; | |
433 } | |
434 // 4E455C: using guessed type int dword_4E455C; | |
435 // 506128: using guessed type int areWeLoadingTexture; | |
436 | |
437 //----- (0041E360) -------------------------------------------------------- | |
438 void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *pWindow) | |
439 { | |
440 unsigned __int16 v9; // dx@4 | |
441 SpriteFrame *v10; // edi@17 | |
442 unsigned int v18; // ecx@19 | |
443 unsigned int v19; // eax@21 | |
444 int skill_points; // edi@61 | |
445 unsigned int skill_level; // eax@61 | |
446 int pTextHeight; // edi@90 | |
447 PlayerSpeech speech; // [sp-8h] [bp-1F4h]@79 | |
448 DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18 | |
449 DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18 | |
450 RECT dest_rect; // [sp+ECh] [bp-100h]@26 | |
451 const char *string_name[10]; // [sp+FCh] [bp-F0h]@145 | |
452 const char *content[11]; // [sp+124h] [bp-C8h]@127 | |
453 unsigned char resistances[11]; // [sp+124h] [bp-C8h]@127 | |
454 RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3 | |
455 unsigned int v107; // [sp+1A0h] [bp-4Ch]@18 | |
456 bool for_effects; // [sp+1C0h] [bp-2Ch]@3 | |
457 bool normal_level; // [sp+1D0h] [bp-1Ch]@18 | |
458 bool expert_level; // [sp+1C4h] [bp-28h]@18 | |
459 bool master_level; // [sp+1C8h] [bp-24h]@18 | |
460 bool grandmaster_level; // [sp+1B4h] [bp-38h]@3 | |
461 const char *pText; // [sp+1D4h] [bp-18h]@18 | |
462 int pTextColorID; // [sp+1E4h] [bp-8h]@18 | |
463 int v115; | |
464 | |
465 bool monster_full_informations = false; | |
466 static Actor pMonsterInfoUI_Doll; | |
467 if ( !uActiveCharacter ) // | |
468 uActiveCharacter = 1; | |
469 | |
470 /*if ( !(bMonsterInfoUI_bDollInitialized & 1) ) | |
471 { | |
472 bMonsterInfoUI_bDollInitialized |= 1u; | |
473 Actor::Actor(&pMonsterInfoUI_Doll); | |
474 atexit(nullsub_3); | |
475 }*/ | |
476 v106.sParentBillboardID = -1; | |
477 v115 = monster_popup_y_offsets[((signed __int16)pActors[uActorID].pMonsterInfo.uID - 1) / 3] - 40; | |
478 if ( pActors[uActorID].pMonsterInfo.uID == pMonsterInfoUI_Doll.pMonsterInfo.uID ) | |
479 v9 = pMonsterInfoUI_Doll.uCurrentActionLength; | |
480 else | |
481 { | |
482 memcpy(&pMonsterInfoUI_Doll, &pActors[uActorID], sizeof(pMonsterInfoUI_Doll)); | |
483 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; | |
484 pMonsterInfoUI_Doll.uCurrentActionTime = 0; | |
485 v9 = rand() % 256 + 128; | |
486 pMonsterInfoUI_Doll.uCurrentActionLength = v9; | |
487 } | |
488 | |
489 if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 ) | |
490 { | |
491 pMonsterInfoUI_Doll.uCurrentActionTime = 0; | |
492 if ( pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_Bored || pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_AtkMelee) | |
493 { | |
494 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Standing; | |
495 pMonsterInfoUI_Doll.uCurrentActionLength = rand() % 128 + 128; | |
496 } | |
497 else | |
498 { | |
499 //rand(); | |
500 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; | |
501 if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) && | |
502 (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) && rand() % 30 < 100 ) | |
503 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_AtkMelee; | |
504 pMonsterInfoUI_Doll.uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[pActors[uActorID].pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength; | |
505 } | |
506 } | |
507 v10 = pSpriteFrameTable->GetFrame( pActors[uActorID].pSpriteIDs[pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime); | |
508 v106.pTarget = pRenderer->pTargetSurface; | |
509 v106.pTargetZ = pRenderer->pActiveZBuffer; | |
510 v106.uTargetPitch = pRenderer->uTargetSurfacePitch; | |
511 v106.uViewportX = pWindow->uFrameX + 13; | |
512 v106.uViewportY = pWindow->uFrameY + 52; | |
513 v106.uViewportW = (pWindow->uFrameY + 52) + 128; | |
514 v106.uViewportZ = v106.uViewportX + 128; | |
515 v106.uScreenSpaceX = (signed int)(v106.uViewportX + 128 + v106.uViewportX) / 2; | |
516 v106._screenspace_x_scaler_packedfloat = 65536; | |
517 v106._screenspace_y_scaler_packedfloat = 65536; | |
518 v106.uScreenSpaceY = v115 + (pWindow->uFrameY + 52) + pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]].uHeight; | |
519 v106.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v10->uPaletteIndex, 0, 1); | |
520 v106.sZValue = 0; | |
521 v106.uFlags = 0; | |
522 pRenderer->SetRasterClipRect(0, 0, window->GetWidth() - 1, window->GetHeight() - 1); | |
523 pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu));//ãîðèçîíòàëüíàÿ âåðõíÿÿ ëèíèÿ | |
524 pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu));//ãîðèçîíòàëüíàÿ íèæíÿÿ ëèíèÿ | |
525 pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu));//ëåâàÿ âåðòèêàëüíàÿ ëèíèÿ | |
526 pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu));//ïðàâàÿ âåðòèêàëüíàÿ ëèíèÿ | |
527 //if ( pRenderer->pRenderD3D ) | |
528 { | |
529 v106.uScreenSpaceY = v115 + v106.uViewportY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; | |
530 | |
531 memset(&Dst, 0, sizeof(Dst)); | |
532 Dst.dwSize = sizeof(Dst); | |
533 Dst.dwFillColor = 0; | |
534 | |
535 memset(&pDesc, 0, sizeof(pDesc)); | |
536 pDesc.dwSize = sizeof(pDesc); | |
537 | |
538 pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->GetSurfaceDesc(&pDesc); | |
539 v107 = 0; | |
540 uint i = 0; | |
541 int dst_x = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2; | |
542 int dst_y = v106.uScreenSpaceY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaY - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; | |
543 uint dst_z = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2 - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth; | |
544 uint dst_w = v106.uScreenSpaceY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; | |
545 if (dst_x < v106.uViewportX) | |
546 { | |
547 v18 = v106.uViewportX - dst_x; | |
548 dst_x = v106.uViewportX; | |
549 v107 = v18; | |
550 } | |
551 if (dst_y < v106.uViewportY) | |
552 { | |
553 v19 = v106.uViewportY - dst_y; | |
554 dst_y = v106.uViewportY; | |
555 i = v19; | |
556 } | |
557 if (dst_z > v106.uViewportZ) | |
558 dst_z = v106.uViewportZ; | |
559 if (dst_w > v106.uViewportW) | |
560 dst_w = v106.uViewportW; | |
561 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0x7FF); | |
562 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0x7FF); | |
563 dest_rect.left = v106.uViewportX; | |
564 dest_rect.top = v106.uViewportY; | |
565 dest_rect.right = v106.uViewportZ; | |
566 dest_rect.bottom = v106.uViewportW; | |
567 | |
568 ErrD3D(pRenderer->pBackBuffer4->Blt(&dest_rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &Dst)); | |
569 /*if ( pRenderer->uTargetGBits == 5 ) | |
570 { | |
571 __debugbreak(); // no monster popup for r5g5b5 will be | |
572 memset(&pDesc, 0, 0x7Cu); | |
573 pDesc.dwSize = 124; | |
574 if ( pRenderer->LockSurface_DDraw4(pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface, &pDesc, DDLOCK_WAIT)) | |
575 { | |
576 v20 = (char *)dst_y; | |
577 v110 = pDesc.lpSurface; | |
578 if (dst_y < dst_w) | |
579 { | |
580 v21 = dst_x; | |
581 //v22 = &pRenderer->pTargetSurface[dst_y * pRenderer->uTargetSurfacePitch + dst_x]; | |
582 ushort* _v22_2 = v22; | |
583 v23 = i - dst_y; | |
584 v115 = i - dst_y; | |
585 while ( 1 ) | |
586 { | |
587 dst_y = v21; | |
588 if ( v21 < dst_z ) | |
589 { | |
590 v25 = v107 - v21; | |
591 v109 = (int)&v20[v23]; | |
592 for ( i = v107 - v21; ; v25 = i ) | |
593 { | |
594 v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight); | |
595 v26 = (char *)v108 + pDesc.dwWidth * (v25 + dst_y++) / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth; | |
596 *v22 = *((short *)v110 + (int)v26); | |
597 ++v22; | |
598 if ( dst_y >= dst_z ) | |
599 break; | |
600 } | |
601 v23 = v115; | |
602 } | |
603 v22 = (unsigned __int16 *)((char *)_v22_2 + 2 * pRenderer->uTargetSurfacePitch); | |
604 _v22_2 = v22; | |
605 v20 = (char *)(dst_y + 1); | |
606 v28 = __OFSUB__(dst_y + 1, dst_w); | |
607 v27 = (signed int)(dst_y++ + 1 - dst_w) < 0; | |
608 if ( !(v27 ^ v28) ) | |
609 break; | |
610 v21 = dst_x; | |
611 } | |
612 } | |
613 pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->Unlock(0); | |
614 } | |
615 } | |
616 else*/ | |
617 { | |
618 memset(&pDesc, 0, sizeof(pDesc)); | |
619 pDesc.dwSize = sizeof(pDesc); | |
620 if ( pRenderer->LockSurface_DDraw4(pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface, &pDesc, DDLOCK_WAIT) ) | |
621 { | |
622 ushort* src = (unsigned __int16 *)pDesc.lpSurface; | |
623 uint num_top_scanlines_above_frame_y = i - dst_y; | |
624 for (uint y = dst_y; y < dst_w; ++y) | |
625 { | |
626 //ushort* dst = &pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + dst_x]; | |
627 | |
628 uint src_y = num_top_scanlines_above_frame_y + y; | |
629 for (uint x = dst_x; x < dst_z; ++x) | |
630 { | |
631 uint src_x = v107 - dst_x + x; // num scanlines left to frame_x + current x | |
632 | |
633 uint idx = pDesc.dwHeight * src_y / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight * (pDesc.lPitch / sizeof(short)) + | |
634 pDesc.dwWidth * src_x / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth; | |
635 uint b = src[idx] & 0x1F; | |
636 //*dst++ = b | 2 * (src[idx] & 0xFFE0); | |
637 pRenderer->WritePixel16(x, y, b | 2 * (src[idx] & 0xFFE0)); | |
638 } | |
639 } | |
640 pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->Unlock(NULL); | |
641 } | |
642 } | |
643 } | |
644 /*else | |
645 { | |
646 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0); | |
647 if ( v10->pHwSpriteIDs[0] >= 0 ) | |
648 pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]].DrawSprite_sw(&v106, 0); | |
649 }*/ | |
650 //name and profession | |
651 if ( pActors[uActorID].sNPC_ID ) | |
652 { | |
653 if (GetNPCData(pActors[uActorID].sNPC_ID)->uProfession) | |
654 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], GetNPCData(pActors[uActorID].sNPC_ID)->pName, aNPCProfessionNames[GetNPCData(pActors[uActorID].sNPC_ID)->uProfession]); // "%s the %s" / ^Pi[%s] %s | |
655 else | |
656 strncpy(pTmpBuf.data(), GetNPCData(pActors[uActorID].sNPC_ID)->pName, 2000); | |
657 } | |
658 else | |
659 { | |
660 if ( pActors[uActorID].dword_000334_unique_name ) | |
661 strncpy(pTmpBuf.data(), pMonsterStats->pPlaceStrings[pActors[uActorID].dword_000334_unique_name], 2000); | |
662 else | |
663 strncpy(pTmpBuf.data(), pMonsterStats->pInfos[pActors[uActorID].pMonsterInfo.uID].pName, 2000); | |
664 } | |
665 pWindow->DrawTitleText(pFontComic, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | |
666 //health bar | |
667 Actor::DrawHealthBar(&pActors[uActorID], pWindow); | |
668 | |
669 normal_level = 0; | |
670 expert_level = 0; | |
671 master_level = 0; | |
672 grandmaster_level = 0; | |
673 for_effects = 0; | |
674 pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
675 if ( pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) | |
676 { | |
677 skill_points = (unsigned __int8)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) & 0x3F; | |
678 skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) - 1; | |
679 if ( skill_level == 0 )//(normal) | |
680 { | |
681 if ( skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) | |
682 normal_level = 1; | |
683 } | |
684 else if ( skill_level == 1 )//(expert) | |
685 { | |
686 if ( 2 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) | |
687 { | |
688 normal_level = 1; | |
689 expert_level = 1; | |
690 } | |
691 } | |
692 else if ( skill_level == 2 )//(master) | |
693 { | |
694 if ( 3 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) | |
695 { | |
696 normal_level = 1; | |
697 expert_level = 1; | |
698 master_level = 1; | |
699 } | |
700 } | |
701 else if ( skill_level == 3 )//grandmaster | |
702 { | |
703 normal_level = 1; | |
704 expert_level = 1; | |
705 master_level = 1; | |
706 grandmaster_level = 1; | |
707 } | |
708 } | |
709 if ( pActors[uActorID].uAIState != Dead | |
710 && pActors[uActorID].uAIState != Dying | |
711 && !dword_507BF0_is_there_popup_onscreen && pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) | |
712 { | |
713 if ( normal_level | expert_level | master_level | grandmaster_level ) | |
714 { | |
715 if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 ) | |
716 speech = SPEECH_IDENTIFY_MONSTER_STRONGER; | |
717 else | |
718 speech = SPEECH_IDENTIFY_MONSTER_WEAKER; | |
719 } | |
720 else | |
721 speech = SPEECH_IDENTIFY_MONSTER_106; | |
722 pPlayers[uActiveCharacter]->PlaySound(speech, 0); | |
723 } | |
724 | |
725 if ( (signed int)SkillToMastery(pParty->pPlayers[uActiveCharacter - 1].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 ) | |
726 for_effects = 1; | |
727 | |
728 if ( monster_full_informations == true ) | |
729 { | |
730 normal_level = 1;// | |
731 expert_level = 1;// | |
732 master_level = 1;// | |
733 grandmaster_level = 1;// | |
734 for_effects = 1; | |
735 } | |
736 | |
737 pWindow->DrawText(pFontSmallnum, 12, 196, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0);//Effects | |
738 if ( !for_effects && false) | |
739 pWindow->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0);//? | |
740 else | |
741 { | |
742 pText = ""; | |
743 pTextHeight = LOBYTE(pFontSmallnum->uFontHeight) + 193; | |
744 for ( uint i = 1; i <= 21; ++i ) | |
745 { | |
746 if ( pActors[uActorID].pActorBuffs[i].uExpireTime > 0 ) | |
747 { | |
748 switch ( i ) | |
749 { | |
750 case ACTOR_BUFF_CHARM: | |
751 pTextColorID = 60; | |
752 pText = pGlobalTXT_LocalizationStrings[591];//Charmed | |
753 break; | |
754 case ACTOR_BUFF_SUMMONED: | |
755 pTextColorID = 82; | |
756 pText = pGlobalTXT_LocalizationStrings[649];//Summoned | |
757 break; | |
758 case ACTOR_BUFF_SHRINK: | |
759 pTextColorID = 92; | |
760 pText = pGlobalTXT_LocalizationStrings[592];//Shrunk | |
761 break; | |
762 case ACTOR_BUFF_AFRAID: | |
763 pTextColorID = 63; | |
764 pText = pGlobalTXT_LocalizationStrings[4];//Afraid | |
765 break; | |
766 case ACTOR_BUFF_STONED: | |
767 pText = pGlobalTXT_LocalizationStrings[220];//Stoned | |
768 pTextColorID = 81; | |
769 break; | |
770 case ACTOR_BUFF_PARALYZED: | |
771 pText = pGlobalTXT_LocalizationStrings[162];//Paralyzed | |
772 pTextColorID = 81; | |
773 break; | |
774 case ACTOR_BUFF_SLOWED: | |
775 pText = pGlobalTXT_LocalizationStrings[593];//Slowed | |
776 pTextColorID = 35; | |
777 break; | |
778 case ACTOR_BUFF_BERSERK: | |
779 pText = pGlobalTXT_LocalizationStrings[608];//Berserk | |
780 pTextColorID = 62; | |
781 break; | |
782 case ACTOR_BUFF_SOMETHING_THAT_HALVES_AC: | |
783 case ACTOR_BUFF_MASS_DISTORTION: | |
784 pText = ""; | |
785 pTextColorID = 0; | |
786 continue; | |
787 case ACTOR_BUFF_FATE: | |
788 pTextColorID = 47; | |
789 pText = pGlobalTXT_LocalizationStrings[221];//Fate | |
790 break; | |
791 case ACTOR_BUFF_ENSLAVED: | |
792 pTextColorID = 66; | |
793 pText = pGlobalTXT_LocalizationStrings[607];//Enslaved | |
794 break; | |
795 case ACTOR_BUFF_DAY_OF_PROTECTION: | |
796 pTextColorID = 85; | |
797 pText = pGlobalTXT_LocalizationStrings[610];//Day of Protection | |
798 break; | |
799 case ACTOR_BUFF_HOUR_OF_POWER: | |
800 pTextColorID = 86; | |
801 pText = pGlobalTXT_LocalizationStrings[609];//Hour of Power | |
802 break; | |
803 case ACTOR_BUFF_SHIELD: | |
804 pTextColorID = 17; | |
805 pText = pGlobalTXT_LocalizationStrings[279];//Shield | |
806 break; | |
807 case ACTOR_BUFF_STONESKIN: | |
808 pTextColorID = 38; | |
809 pText = pGlobalTXT_LocalizationStrings[442];//Stoneskin | |
810 break; | |
811 case ACTOR_BUFF_BLESS: | |
812 pTextColorID = 46; | |
813 pText = pGlobalTXT_LocalizationStrings[443];//Bless | |
814 break; | |
815 case ACTOR_BUFF_HEROISM: | |
816 pTextColorID = 51; | |
817 pText = pGlobalTXT_LocalizationStrings[440];//Heroism | |
818 break; | |
819 case ACTOR_BUFF_HASTE: | |
820 pTextColorID = 5; | |
821 pText = pGlobalTXT_LocalizationStrings[441];//Haste | |
822 break; | |
823 case ACTOR_BUFF_PAIN_REFLECTION: | |
824 pTextColorID = 95; | |
825 pText = pGlobalTXT_LocalizationStrings[229];//Pain Reflection | |
826 break; | |
827 case ACTOR_BUFF_PAIN_HAMMERHANDS: | |
828 pTextColorID = 73; | |
829 pText = pGlobalTXT_LocalizationStrings[228];//Hammerhands | |
830 break; | |
831 default: | |
832 pText = ""; | |
833 break; | |
834 } | |
835 if ( _stricmp(pText, "" )) | |
836 { | |
837 pWindow->DrawText(pFontSmallnum, 28, pTextHeight, GetSpellColor(pTextColorID), pText, 0, 0, 0); | |
838 pTextHeight = pTextHeight + *(char *)((int)pFontSmallnum + 5) - 3; | |
839 } | |
840 } | |
841 } | |
842 if ( !_stricmp(pText,"" )) | |
843 pWindow->DrawText(pFontSmallnum, 28, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[153], 0, 0, 0);//Íåò | |
844 } | |
845 | |
846 if ( normal_level ) | |
847 { | |
848 sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, pActors[uActorID].pMonsterInfo.uHP); | |
849 pWindow->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
850 pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
851 sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[12], 0, pActors[uActorID].pMonsterInfo.uAC);//Armor Class | |
852 } | |
853 else | |
854 { | |
855 sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);//? - [630] actually displays a question mark | |
856 pWindow->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
857 pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
858 sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[12], 0, pGlobalTXT_LocalizationStrings[630]);//? - [630] actually displays a question mark | |
859 } | |
860 pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
861 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight); | |
862 | |
863 content[0] = pGlobalTXT_LocalizationStrings[87]; | |
864 content[1] = pGlobalTXT_LocalizationStrings[6]; | |
865 content[2] = pGlobalTXT_LocalizationStrings[240]; | |
866 content[3] = pGlobalTXT_LocalizationStrings[70]; | |
867 content[4] = pGlobalTXT_LocalizationStrings[624]; | |
868 content[5] = pGlobalTXT_LocalizationStrings[138]; | |
869 content[6] = pGlobalTXT_LocalizationStrings[214]; | |
870 content[7] = pGlobalTXT_LocalizationStrings[142]; | |
871 content[8] = pGlobalTXT_LocalizationStrings[29]; | |
872 content[9] = pGlobalTXT_LocalizationStrings[133]; | |
873 content[10] = pGlobalTXT_LocalizationStrings[54]; | |
874 | |
875 if ( expert_level ) | |
876 { | |
877 sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, content[pActors[uActorID].pMonsterInfo.uAttack1Type]);//Attack | |
878 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
879 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
880 if ( pActors[uActorID].pMonsterInfo.uAttack1DamageBonus ) | |
881 sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53], | |
882 0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides, pActors[uActorID].pMonsterInfo.uAttack1DamageBonus); | |
883 else | |
884 sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53], | |
885 0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides); | |
886 } | |
887 else | |
888 { | |
889 sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); | |
890 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
891 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
892 sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]); | |
893 } | |
894 pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
895 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight); | |
896 | |
897 if ( !master_level ) | |
898 { | |
899 sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[630]);//"Spell" "?" | |
900 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
901 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
902 } | |
903 else | |
904 { | |
905 pText = pGlobalTXT_LocalizationStrings[628];//Spell | |
906 if ( pActors[uActorID].pMonsterInfo.uSpell1ID && pActors[uActorID].pMonsterInfo.uSpell2ID ) | |
907 pText = pGlobalTXT_LocalizationStrings[629];//Spells | |
908 if ( pActors[uActorID].pMonsterInfo.uSpell1ID ) | |
909 { | |
910 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pText, 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell1ID].pShortName);//"%s\f%05u\t060%s\n" | |
911 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
912 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
913 } | |
914 if ( pActors[uActorID].pMonsterInfo.uSpell2ID ) | |
915 { | |
916 sprintf(pTmpBuf.data(), "\f%05u\t070%s\n", 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell2ID].pShortName);//"%s\f%05u\t060%s\n" | |
917 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
918 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
919 } | |
920 if ( !pActors[uActorID].pMonsterInfo.uSpell1ID && !pActors[uActorID].pMonsterInfo.uSpell2ID ) | |
921 { | |
922 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[153]);//"%s\f%05u\t060%s\n" | |
923 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
924 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
925 } | |
926 } | |
927 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
928 pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[626], 0, 0, 0);//Immune | |
929 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
930 | |
931 string_name[0] = pGlobalTXT_LocalizationStrings[87];//Fire | |
932 string_name[1] = pGlobalTXT_LocalizationStrings[6];//Air | |
933 string_name[2] = pGlobalTXT_LocalizationStrings[240]; | |
934 string_name[3] = pGlobalTXT_LocalizationStrings[70]; | |
935 string_name[4] = pGlobalTXT_LocalizationStrings[142]; | |
936 string_name[5] = pGlobalTXT_LocalizationStrings[214]; | |
937 string_name[6] = pGlobalTXT_LocalizationStrings[29]; | |
938 string_name[7] = pGlobalTXT_LocalizationStrings[133]; | |
939 string_name[8] = pGlobalTXT_LocalizationStrings[54]; | |
940 string_name[9] = pGlobalTXT_LocalizationStrings[624]; | |
941 | |
942 resistances[0] = pActors[uActorID].pMonsterInfo.uResFire; | |
943 resistances[1] = pActors[uActorID].pMonsterInfo.uResAir; | |
944 resistances[2] = pActors[uActorID].pMonsterInfo.uResWater; | |
945 resistances[3] = pActors[uActorID].pMonsterInfo.uResEarth; | |
946 resistances[4] = pActors[uActorID].pMonsterInfo.uResMind; | |
947 resistances[5] = pActors[uActorID].pMonsterInfo.uResSpirit; | |
948 resistances[6] = pActors[uActorID].pMonsterInfo.uResBody; | |
949 resistances[7] = pActors[uActorID].pMonsterInfo.uResLight; | |
950 resistances[8] = pActors[uActorID].pMonsterInfo.uResPhysical; | |
951 resistances[9] = pActors[uActorID].pMonsterInfo.uResDark; | |
952 | |
953 if ( grandmaster_level ) | |
954 { | |
955 for ( uint i = 0; i < 10; i++ ) | |
956 { | |
957 if ( resistances[i] == 200 ) | |
958 { | |
959 pText = pGlobalTXT_LocalizationStrings[625];//Immune | |
960 } | |
961 else | |
962 { | |
963 if ( resistances[i] ) | |
964 pText = pGlobalTXT_LocalizationStrings[627];//Resistant | |
965 else | |
966 pText = pGlobalTXT_LocalizationStrings[153];//None | |
967 } | |
968 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pText); | |
969 pWindow->DrawText(pFontSmallnum, 170, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
970 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
971 } | |
972 } | |
973 else | |
974 { | |
975 for ( uint i = 0; i < 10; ++i ) | |
976 { | |
977 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?" | |
978 pWindow->DrawText(pFontSmallnum, 170, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
979 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
980 } | |
981 } | |
982 //cast spell: Detect life | |
983 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 ) | |
984 { | |
985 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], pActors[uActorID].sCurrentHP);//Current Hit Points | |
986 pFontSmallnum->GetLineWidth(pTmpBuf.data()); | |
987 pWindow->DrawTitleText(pFontSmallnum, 0, pWindow->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf.data(), 3); | |
988 } | |
989 } | |
990 | |
991 //----- (00417BB5) -------------------------------------------------------- | |
992 const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType) | |
993 { | |
994 char a2[1200]; // [sp+Ch] [bp-538h]@7 | |
995 char Source[120]; // [sp+4BCh] [bp-88h]@7 | |
996 int v35; // [sp+53Ch] [bp-8h]@1 | |
997 | |
998 v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal | |
999 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]) > (signed int)v35 ) | |
1000 v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert | |
1001 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]) > (signed int)v35 ) | |
1002 v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master | |
1003 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]) > (signed int)v35 ) | |
1004 v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);// Grand | |
1005 | |
1006 a2[0] = 0; | |
1007 Source[0] = 0; | |
1008 strcpy(a2, "%s\n\n"); | |
1009 sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 1)); | |
1010 strcat(a2, Source); | |
1011 strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); | |
1012 sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 2)); | |
1013 strcat(a2, Source); | |
1014 strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); | |
1015 sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 3)); | |
1016 strcat(a2, Source); | |
1017 strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); | |
1018 sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 4)); | |
1019 strcat(a2, Source); | |
1020 strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); | |
1021 if ( (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F) == (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) ) | |
1022 { | |
1023 sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], | |
1024 pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], // Normal | |
1025 pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], // Expert | |
1026 pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], // Master | |
1027 pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType]); // Grand | |
1028 } | |
1029 else | |
1030 { | |
1031 sprintf(Source, "\f%05d", Color16(0xFFu, 0xFFu, 0xFFu)); | |
1032 strcat(a2, Source); | |
1033 strcat(a2, "%s: +%d"); | |
1034 sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], | |
1035 pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], | |
1036 pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], | |
1037 pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], | |
1038 pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType], | |
1039 pGlobalTXT_LocalizationStrings[623], //Bonus | |
1040 (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) - (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F)); | |
1041 } | |
1042 return static_sub_417BB5_out_string; | |
1043 } | |
1044 | |
1045 //----- (00417FE5) -------------------------------------------------------- | |
1046 void CharacterUI_SkillsTab_ShowHint() | |
1047 { | |
1048 GUIButton *pButton; // esi@6 | |
1049 unsigned int pX; // [sp+4h] [bp-8h]@1 | |
1050 unsigned int pY; // [sp+8h] [bp-4h]@1 | |
1051 | |
1052 pMouse->GetClickPos(&pX, &pY); | |
1053 if ( (signed int)pX < 24 || (signed int)pX > 455 || (signed int)pY < 18 || (signed int)pY > 36 ) | |
1054 { | |
1055 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) | |
1056 { | |
1057 if ( pButton->msg == UIMSG_SkillUp | |
1058 && (signed int)pX >= (signed int)pButton->uX | |
1059 && (signed int)pX <= (signed int)pButton->uZ | |
1060 && (signed int)pY >= (signed int)pButton->uY | |
1061 && (signed int)pY <= (signed int)pButton->uW ) | |
1062 { | |
1063 CharacterUI_DrawTooltip(pSkillNames[pButton->msg_param], CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)pButton->msg_param)); | |
1064 } | |
1065 } | |
1066 } | |
1067 else | |
1068 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);//Î÷êè íàâûêîâ | |
1069 } | |
1070 | |
1071 //----- (00418083) -------------------------------------------------------- | |
1072 void CharacterUI_StatsTab_ShowHint() | |
1073 { | |
1074 int pStringNum; // edi@1 | |
1075 signed int pTextColor; // eax@15 | |
1076 const char *pHourWord; // ecx@17 | |
1077 const char *pDayWord; // eax@20 | |
1078 int v15; // ebx@28 | |
1079 POINT a2; // [sp+Ch] [bp-24h]@1 | |
1080 int pHour; // [sp+14h] [bp-1Ch]@15 | |
1081 unsigned int pDay; // [sp+24h] [bp-Ch]@15 | |
1082 | |
1083 pMouse->GetCursorPos(&a2); | |
1084 for ( pStringNum = 0; pStringNum < stat_string_coord.size(); ++pStringNum ) | |
1085 { | |
1086 if (a2.x >= stat_string_coord[pStringNum].x && a2.x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width ) | |
1087 { | |
1088 if (a2.y >= stat_string_coord[pStringNum].y && a2.y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height ) | |
1089 break; | |
1090 } | |
1091 } | |
1092 | |
1093 switch ( pStringNum ) | |
1094 { | |
1095 case 0:// Attributes | |
1096 case 1: | |
1097 case 2: | |
1098 case 3: | |
1099 case 4: | |
1100 case 5: | |
1101 case 6: | |
1102 if ( aAttributeNames[pStringNum] && pAttributeDescriptions[pStringNum] ) | |
1103 CharacterUI_DrawTooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]); | |
1104 break; | |
1105 case 7:// Health Points | |
1106 if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription ) | |
1107 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription); | |
1108 break; | |
1109 case 8:// Spell Points | |
1110 if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription ) | |
1111 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription); | |
1112 break; | |
1113 case 9:// Armor Class | |
1114 if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription ) | |
1115 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription); | |
1116 break; | |
1117 case 10:// Player Condition | |
1118 strcpy(pTmpBuf2.data(), pPlayerConditionAttributeDescription); | |
1119 strcat(pTmpBuf2.data(), "\n"); | |
1120 extern std::array<unsigned int, 18> pConditionImportancyTable; | |
1121 for ( uint i = 0; i < 18; ++i ) | |
1122 { | |
1123 if ( pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]] ) | |
1124 { | |
1125 strcat(pTmpBuf2.data(), " \n"); | |
1126 pHour = pParty->uTimePlayed - pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]]; | |
1127 pHour = (unsigned int)((pHour * 0.234375) / 60 / 60); | |
1128 pDay = (unsigned int)pHour / 24; | |
1129 pHour %= 24i64; | |
1130 pTextColor = GetConditionDrawColor(pConditionImportancyTable[i]); | |
1131 sprintfex(pTmpBuf.data(), format_4E2DE8, pTextColor, aCharacterConditionNames[pConditionImportancyTable[i]]); | |
1132 strcat(pTmpBuf2.data(), pTmpBuf.data()); | |
1133 if ( pHour && pHour <= 1 ) | |
1134 pHourWord = pGlobalTXT_LocalizationStrings[109]; | |
1135 else | |
1136 pHourWord = pGlobalTXT_LocalizationStrings[110]; | |
1137 if ( !pDay || (pDayWord = pGlobalTXT_LocalizationStrings[56], pDay > 1) ) | |
1138 pDayWord = pGlobalTXT_LocalizationStrings[57]; | |
1139 sprintfex(pTmpBuf.data(), "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord); | |
1140 strcat(pTmpBuf2.data(), pTmpBuf.data()); | |
1141 } | |
1142 } | |
1143 if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2.data() ) | |
1144 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data()); | |
1145 break; | |
1146 case 11:// Fast Spell | |
1147 if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription ) | |
1148 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription); | |
1149 break; | |
1150 case 12:// Player Age | |
1151 if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription ) | |
1152 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription); | |
1153 break; | |
1154 case 13:// Player Level | |
1155 if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription ) | |
1156 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription); | |
1157 break; | |
1158 case 14://Experience | |
1159 v15 = pPlayers[uActiveCharacter]->uLevel; | |
1160 do | |
1161 { | |
1162 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)GetExperienceRequiredForLevel(v15) ) | |
1163 break; | |
1164 ++v15; | |
1165 } | |
1166 while ( v15 <= 10000 ); | |
1167 pTmpBuf[0] = 0; | |
1168 pTmpBuf2[0] = 0; | |
1169 if ( v15 > pPlayers[uActiveCharacter]->uLevel ) | |
1170 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[147], v15); | |
1171 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], GetExperienceRequiredForLevel(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience), v15 + 1); | |
1172 strcat(pTmpBuf.data(), "\n"); | |
1173 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
1174 sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data()); | |
1175 if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2.data() ) | |
1176 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data()); | |
1177 break; | |
1178 case 15:// Attack Bonus | |
1179 if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription ) | |
1180 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription); | |
1181 break; | |
1182 case 16:// Attack Damage | |
1183 if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription ) | |
1184 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription); | |
1185 break; | |
1186 case 17:// Missle Bonus | |
1187 if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription ) | |
1188 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription); | |
1189 break; | |
1190 case 18:// Missle Damage | |
1191 if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription ) | |
1192 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription); | |
1193 break; | |
1194 case 19:// Fire Resistance | |
1195 if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription ) | |
1196 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription); | |
1197 break; | |
1198 case 20:// Air Resistance | |
1199 if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription ) | |
1200 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription); | |
1201 break; | |
1202 case 21:// Water Resistance | |
1203 if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription ) | |
1204 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription); | |
1205 break; | |
1206 case 22:// Earth Resistance | |
1207 if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription ) | |
1208 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription); | |
1209 break; | |
1210 case 23:// Mind Resistance | |
1211 if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription ) | |
1212 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription); | |
1213 break; | |
1214 case 24:// Body Resistance | |
1215 if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription ) | |
1216 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription); | |
1217 break; | |
1218 case 25: // Skill Points | |
1219 if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription ) | |
1220 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription); | |
1221 break; | |
1222 case 26: // Class description | |
1223 { | |
1224 if (pClassDescriptions[pPlayers[uActiveCharacter]->classType] && pClassNames[pPlayers[uActiveCharacter]->classType]) | |
1225 CharacterUI_DrawTooltip(pClassNames[pPlayers[uActiveCharacter]->classType], pClassDescriptions[pPlayers[uActiveCharacter]->classType]); | |
1226 } | |
1227 break; | |
1228 | |
1229 default: | |
1230 break; | |
1231 } | |
1232 } | |
1233 | |
1234 //----- (00410B28) -------------------------------------------------------- | |
1235 void DrawSpellDescriptionPopup(int spell_index) | |
1236 { | |
1237 SpellInfo *spell; // esi@1 | |
1238 unsigned int v3; // eax@2 | |
1239 LONG v5; // ecx@4 | |
1240 GUIWindow spell_info_window; // [sp+Ch] [bp-68h]@4 | |
1241 POINT mouse; // [sp+64h] [bp-10h]@1 | |
1242 | |
1243 spell = &pSpellStats->pInfos[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1]; | |
1244 if ( pMouse->GetCursorPos(&mouse)->y <= 250 ) | |
1245 v3 = pMouse->GetCursorPos(&mouse)->y + 30; | |
1246 else | |
1247 v3 = 30; | |
1248 spell_info_window.uFrameY = v3; | |
1249 spell_info_window.uFrameWidth = 328; | |
1250 spell_info_window.uFrameHeight = 68; | |
1251 spell_info_window.uFrameX = 90; | |
1252 spell_info_window.uFrameZ = 417; | |
1253 spell_info_window.uFrameW = v3 + 67; | |
1254 spell_info_window.Hint = nullptr; | |
1255 v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]); | |
1256 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]) > v5 ) | |
1257 v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]); | |
1258 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]) > v5 ) | |
1259 v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]); | |
1260 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]) > v5 ) | |
1261 v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]); | |
1262 sprintf(pTmpBuf2.data(), | |
1263 "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", | |
1264 spell->pDescription, | |
1265 pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL], v5 + 3, v5 + 10, spell->pBasicSkillDesc, | |
1266 pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT], v5 + 3, v5 + 10, spell->pExpertSkillDesc, | |
1267 pGlobalTXT_LocalizationStrings[LOCSTR_MASTER], v5 + 3, v5 + 10, spell->pMasterSkillDesc, | |
1268 pGlobalTXT_LocalizationStrings[LOCSTR_GRAND], v5 + 3, v5 + 10, spell->pGrandmasterSkillDesc); | |
1269 spell_info_window.uFrameHeight += pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &spell_info_window, 0, 0); | |
1270 if ( (signed int)spell_info_window.uFrameHeight < 150 ) | |
1271 spell_info_window.uFrameHeight = 150; | |
1272 spell_info_window.uFrameWidth = game_viewport_width; | |
1273 spell_info_window.DrawMessageBox(0); | |
1274 spell_info_window.uFrameWidth -= 12; | |
1275 spell_info_window.uFrameHeight -= 12; | |
1276 spell_info_window.uFrameZ = spell_info_window.uFrameX + spell_info_window.uFrameWidth - 1; | |
1277 spell_info_window.uFrameW = spell_info_window.uFrameHeight + spell_info_window.uFrameY - 1; | |
1278 spell_info_window.DrawTitleText(pFontArrus, 0x78u, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), spell->pName, 3); | |
1279 spell_info_window.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); | |
1280 spell_info_window.uFrameWidth = 108; | |
1281 spell_info_window.uFrameZ = spell_info_window.uFrameX + 107; | |
1282 int skill_level = SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12]); | |
1283 spell_info_window.DrawTitleText(pFontComic, 12, 75, 0, pSkillNames[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12], 3); | |
1284 sprintf( pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST], | |
1285 pSpellDatas[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1].mana_per_skill[skill_level - 1]); | |
1286 spell_info_window.DrawTitleText(pFontComic, 12, spell_info_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); | |
1287 dword_507B00_spell_info_to_draw_in_popup = 0; | |
1288 } | |
1289 // 507B00: using guessed type int dword_507B00_spell_info_to_draw_in_popup; | |
1290 | |
1291 //----- (00416D62) -------------------------------------------------------- | |
1292 void UI_OnMouseRightClick(Vec2_int_ *_this) | |
1293 { | |
1294 int v5; // esi@62 | |
1295 GUIButton *pButton; // esi@84 | |
1296 const char *pStr; // edi@85 | |
1297 const char *pHint; // edx@113 | |
1298 GUIWindow popup_window; // [sp+4h] [bp-74h]@32 | |
1299 struct tagPOINT Point; // [sp+60h] [bp-18h]@6 | |
1300 unsigned int pX; // [sp+70h] [bp-8h]@3 | |
1301 unsigned int pY; // [sp+74h] [bp-4h]@3 | |
1302 | |
2541 | 1303 if ( current_screen_type == SCREEN_VIDEO || GetCurrentMenuID() == MENU_MAIN ) |
2501 | 1304 return; |
1305 if ( _this ) | |
1306 { | |
1307 pX = _this->x; | |
1308 pY = _this->y; | |
1309 } | |
1310 else | |
1311 { | |
1312 pMouse->GetClickPos(&pX, &pY); | |
1313 } | |
1314 //if ( pRenderer->bWindowMode ) | |
1315 { | |
1316 GetCursorPos(&Point); | |
1317 ScreenToClient(window->GetApiHandle(), &Point); | |
1318 if ( Point.x < 1 || Point.y < 1 || Point.x > 638 || Point.y > 478 ) | |
1319 { | |
1320 back_to_game(); | |
1321 return; | |
1322 } | |
1323 } | |
1324 if ( pParty->pPickedItem.uItemID )//íàæàòèå íà ïîðòðåò ïåðñà ïðàâîé êíîïêîé ìûøè ñ ðàñòâîðîì | |
1325 { | |
1326 for ( uint i = 0; i < 4; ++i ) | |
1327 { | |
1328 if ( (signed int)pX > RightClickPortraitXmin[i] && (signed int)pX < RightClickPortraitXmax[i] | |
1329 && (signed int)pY > 375 && (signed int)pY < 466 ) | |
1330 { | |
1331 pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(i + 1, 1); | |
1332 return; | |
1333 } | |
1334 } | |
1335 } | |
1336 | |
1337 pEventTimer->Pause(); | |
2541 | 1338 switch(current_screen_type) |
2501 | 1339 { |
1340 case SCREEN_CASTING: | |
1341 { | |
1342 Inventory_ItemPopupAndAlchemy(); | |
1343 break; | |
1344 } | |
1345 case SCREEN_CHEST: | |
1346 { | |
1347 if ( !pPlayers[uActiveCharacter]->CanAct() ) | |
1348 { | |
1349 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s íå â ñîñòîÿíèè %s Îïîçíàòü ïðåäìåòû | |
1350 popup_window.Hint = pTmpBuf.data(); | |
1351 popup_window.uFrameWidth = 384; | |
1352 popup_window.uFrameHeight = 180; | |
1353 popup_window.uFrameY = 40; | |
1354 if ( (signed int)pX <= 320 ) | |
1355 popup_window.uFrameX = pX + 30; | |
1356 else | |
1357 popup_window.uFrameX = pX - 414; | |
1358 popup_window.DrawMessageBox(0); | |
1359 } | |
1360 else | |
1361 { | |
1362 if ( pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF ) | |
1363 GameUI_DrawItemInfo(&pChests[pChestWindow->par1C].igChestItems[pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF) - 1] - 1]); | |
1364 } | |
1365 break; | |
1366 } | |
1367 case SCREEN_GAME://In the main menu displays a pop-up window(Â ãëàâíîì ìåíþ ïîêàçûâàåò âñïëûâàþùåå îêíî) | |
1368 { | |
1369 if (GetCurrentMenuID() > 0) | |
1370 break; | |
1371 if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y ) | |
1372 { | |
1373 popup_window.ptr_1C = (void *)((signed int)pX / 118); | |
1374 if ( (signed int)pX / 118 < 4 )//portaits zone | |
1375 { | |
1376 popup_window.Hint = nullptr; | |
1377 popup_window.uFrameWidth = 400; | |
1378 popup_window.uFrameHeight = 200; | |
1379 popup_window.uFrameX = 38; | |
1380 popup_window.uFrameY = 60; | |
1381 pAudioPlayer->StopChannels(-1, -1); | |
1382 GameUI_CharacterQuickRecord_Draw(&popup_window, pPlayers[(int)popup_window.ptr_1C + 1]); | |
1383 } | |
1384 } | |
1385 else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X ) | |
1386 { | |
1387 if ( (signed int)pY >= 130 ) | |
1388 { | |
1389 if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 )//buff_tooltip zone | |
1390 { | |
1391 popup_window.Hint = nullptr; | |
1392 popup_window.uFrameWidth = 400; | |
1393 popup_window.uFrameHeight = 200; | |
1394 popup_window.uFrameX = 38; | |
1395 popup_window.uFrameY = 60; | |
1396 pAudioPlayer->StopChannels(-1, -1); | |
1397 popup_window._41D73D_draw_buff_tooltip(); | |
1398 } | |
1399 else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 )//NPC zone | |
1400 { | |
1401 if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 )) | |
1402 { | |
1403 pAudioPlayer->StopChannels(-1, -1); | |
1404 GameUI_DrawNPCPopup((void *)1);//NPC 2 | |
1405 } | |
1406 } | |
1407 else | |
1408 { | |
1409 pAudioPlayer->StopChannels(-1, -1); | |
1410 GameUI_DrawNPCPopup(0);//NPC 1 | |
1411 } | |
1412 } | |
1413 else//minimap zone | |
1414 { | |
1415 popup_window.Hint = (char *)GameUI_GetMinimapHintText(); | |
1416 popup_window.uFrameWidth = 256; | |
1417 popup_window.uFrameX = 130; | |
1418 popup_window.uFrameY = 140; | |
1419 popup_window.uFrameHeight = 64; | |
1420 pAudioPlayer->StopChannels(-1, -1); | |
1421 popup_window.DrawMessageBox(0); | |
1422 } | |
1423 } | |
1424 else//game zone | |
1425 { | |
1426 popup_window.Hint = nullptr; | |
1427 popup_window.uFrameWidth = 320; | |
1428 popup_window.uFrameHeight = 320; | |
1429 popup_window.uFrameX = pX - 350; | |
1430 if ( (signed int)pX <= 320 ) | |
1431 popup_window.uFrameX = pX + 30; | |
1432 popup_window.uFrameY = 40; | |
1433 //if ( pRenderer->pRenderD3D ) | |
2541 | 1434 v5 = pEngine->pVisInstance->get_picked_object_zbuf_val(); |
2501 | 1435 /*else |
1436 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];*/ | |
1437 if (PID_TYPE((unsigned __int16)v5) == OBJECT_Actor) | |
1438 { | |
1439 /*if ( pRenderer->uNumSceneBegins ) | |
1440 { | |
1441 popup_window.DrawMessageBox(1); | |
1442 MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); | |
1443 } | |
1444 else*/ | |
1445 { | |
1446 pRenderer->BeginScene(); | |
1447 popup_window.DrawMessageBox(1); | |
1448 MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); | |
1449 pRenderer->EndScene(); | |
1450 } | |
1451 } | |
1452 if (PID_TYPE((unsigned __int16)v5) == OBJECT_Item) | |
1453 { | |
1454 if ( !(pObjectList->pObjects[pSpriteObjects[PID_ID((unsigned __int16)v5)].uObjectDescID].uFlags & 0x10 ) ) | |
1455 { | |
1456 GameUI_DrawItemInfo(&pSpriteObjects[PID_ID((unsigned __int16)v5)].stru_24); | |
1457 } | |
1458 } | |
1459 } | |
1460 break; | |
1461 } | |
1462 case SCREEN_BOOKS: | |
1463 { | |
1464 if ( !dword_506364 | |
1465 || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X | |
1466 || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y | |
1467 || ((popup_window.Hint = (char *)GetMapBookHintText()) == 0) ) | |
1468 break; | |
1469 popup_window.uFrameWidth = (pFontArrus->GetLineWidth(popup_window.Hint) + 32) + 0.5f; | |
1470 popup_window.uFrameX = pX + 5; | |
1471 popup_window.uFrameY = pY + 5; | |
1472 popup_window.uFrameHeight = 64; | |
1473 pAudioPlayer->StopChannels(-1, -1); | |
1474 popup_window.DrawMessageBox(0); | |
1475 break; | |
1476 } | |
1477 case SCREEN_CHARACTERS: | |
1478 case SCREEN_E: | |
1479 case SCREEN_CHEST_INVENTORY: | |
1480 { | |
2541 | 1481 if ( (signed int)pX > 467 && current_screen_type != SCREEN_E ) |
2501 | 1482 Inventory_ItemPopupAndAlchemy(); |
1483 else if ( (signed int)pY >= 345 ) | |
1484 break; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
1485 else if (current_character_screen_window == WINDOW_CharacterWindow_Stats)//2DEvent - CharacerScreenStats |
2501 | 1486 CharacterUI_StatsTab_ShowHint(); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
1487 else if (current_character_screen_window == WINDOW_CharacterWindow_Skills)//2DEvent - CharacerScreenSkills |
2501 | 1488 CharacterUI_SkillsTab_ShowHint(); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
1489 else if (current_character_screen_window == WINDOW_CharacterWindow_Inventory)//2DEvent - CharacerScreenInventory |
2501 | 1490 Inventory_ItemPopupAndAlchemy(); |
1491 break; | |
1492 } | |
1493 case SCREEN_SPELL_BOOK: | |
1494 { | |
1495 if ( dword_507B00_spell_info_to_draw_in_popup ) | |
1496 DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); | |
1497 break; | |
1498 } | |
1499 case SCREEN_HOUSE: | |
1500 { | |
1501 if ( (signed int)pY < 345 && (signed int)pX < 469 ) | |
1502 ShowPopupShopItem(); | |
1503 break; | |
1504 } | |
1505 case SCREEN_PARTY_CREATION: | |
1506 { | |
1507 popup_window.Hint = nullptr; | |
1508 pStr = 0; | |
1509 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) | |
1510 { | |
1511 if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ | |
1512 && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) | |
1513 { | |
1514 switch ( pButton->msg ) | |
1515 { | |
1516 case UIMSG_0: //stats info | |
1517 popup_window.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7]; | |
1518 pStr = aAttributeNames[(signed int)pButton->msg_param % 7]; | |
1519 break; | |
1520 case UIMSG_PlayerCreationClickPlus: //Plus button info | |
1521 pStr = pGlobalTXT_LocalizationStrings[670];//Äîáàâèòü | |
1522 popup_window.Hint = pGlobalTXT_LocalizationStrings[671];//"Äîáàâëÿåò î÷êî ê âûäåëåííîìó íàâûêó, çàáèðàÿ åãî èç íàêîïèòåëÿ î÷êîâ" | |
1523 break; | |
1524 case UIMSG_PlayerCreationClickMinus: //Minus button info | |
1525 pStr = pGlobalTXT_LocalizationStrings[668];//Âû÷åñòü | |
1526 popup_window.Hint = pGlobalTXT_LocalizationStrings[669];//"Âû÷èòàåò î÷êî èç âûäåëåííîãî íàâûêà, âîçâðàùàÿ åãî â íàêîïèòåëü î÷êîâ" | |
1527 break; | |
1528 case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info | |
1529 pStr = pSkillNames[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; | |
1530 popup_window.Hint = pSkillDesc[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; | |
1531 break; | |
1532 case UIMSG_PlayerCreationSelectClass: //Available Class Info | |
1533 popup_window.Hint = pClassDescriptions[pButton->msg_param]; | |
1534 pStr = pClassNames[pButton->msg_param]; | |
1535 break; | |
1536 case UIMSG_PlayerCreationClickOK: //OK Info | |
1537 popup_window.Hint = pGlobalTXT_LocalizationStrings[664];//Ùåëêíèòå çäåñü äëÿ óòâåðæäåíèÿ ñîñòàâà îòðÿäà è ïðîäîëæåíèÿ èãðû. | |
1538 pStr = pGlobalTXT_LocalizationStrings[665];//Êíîïêà ÎÊ | |
1539 break; | |
1540 case UIMSG_PlayerCreationClickReset: //Clear info | |
1541 popup_window.Hint = pGlobalTXT_LocalizationStrings[666];//Ñáðàñûâàåò âñå ïàðàìåòðû è íàâûêè îòðÿäà. | |
1542 pStr = pGlobalTXT_LocalizationStrings[667];//Êíîïêà Î÷èñòèòü | |
1543 break; | |
1544 case UIMSG_PlayerCreation_SelectAttribute: // Character info | |
1545 pStr = pParty->pPlayers[pButton->msg_param].pName; | |
1546 popup_window.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType]; | |
1547 break; | |
1548 } | |
1549 if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info | |
1550 { | |
1551 pY = 0; | |
1552 if ( (signed int)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48) < 37 ) | |
1553 { | |
1554 strcpy(pTmpBuf2.data(), CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48))); | |
1555 popup_window.Hint = pTmpBuf2.data(); | |
1556 pStr = pSkillNames[pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48)]; | |
1557 } | |
1558 } | |
1559 } | |
1560 } | |
1561 if ( popup_window.Hint ) | |
1562 { | |
1563 pHint = popup_window.Hint; | |
1564 popup_window.Hint = nullptr; | |
1565 popup_window.uFrameWidth = 384; | |
1566 popup_window.uFrameHeight = 256; | |
1567 popup_window.uFrameX = 128; | |
1568 popup_window.uFrameY = 40; | |
1569 popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; | |
1570 popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; | |
1571 popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; | |
1572 popup_window.DrawMessageBox(0); | |
1573 popup_window.uFrameX += 12; | |
1574 popup_window.uFrameWidth -= 24; | |
1575 popup_window.uFrameY += 12; | |
1576 popup_window.uFrameHeight -= 12; | |
1577 popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; | |
1578 popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; | |
1579 sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", Color16(0xFF, 0xFF, 0x9B), pStr); | |
1580 popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); | |
1581 popup_window.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); | |
1582 } | |
1583 break; | |
1584 } | |
1585 default: | |
1586 break; | |
1587 } | |
1588 dword_507BF0_is_there_popup_onscreen = 1; | |
1589 viewparams->bRedrawGameUI = 1; | |
1590 } | |
1591 int no_rightlick_in_inventory = false; // 0050CDCC | |
1592 //----- (00416196) -------------------------------------------------------- | |
1593 void Inventory_ItemPopupAndAlchemy() | |
1594 { | |
1595 int potion1_id; // edx@25 | |
1596 unsigned int potion2_id; // edi@25 | |
1597 signed int potionID; // edx@27 | |
1598 unsigned int pOut_y; // edx@57 | |
1599 double v31; // st7@112 | |
1600 Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 | |
1601 GUIWindow message_window; // [sp+Ch] [bp-84h]@137 | |
1602 POINT cursor; // [sp+78h] [bp-18h]@2 | |
1603 unsigned int damage_level; // [sp+8Ch] [bp-4h]@23 | |
1604 | |
1605 if (no_rightlick_in_inventory) | |
1606 return; | |
1607 | |
1608 pMouse->GetCursorPos(&cursor); | |
1609 int item_pid = (pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF) - 1; | |
1610 if (item_pid == -1) //added here to avoid crash | |
1611 return; | |
1612 ItemGen* item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid]; | |
1613 | |
1614 if (cursor.x <= 13 || cursor.x >= 462)//items out of inventory(âåùè âíå èíâåíòàðÿ) | |
1615 { | |
1616 GameUI_DrawItemInfo(item); | |
1617 return; | |
1618 } | |
1619 | |
1620 if (!item_pid) | |
1621 { | |
1622 int inventory_mouse_x = cursor.x - 14; | |
1623 int inventory_mouse_y = cursor.y - 17; | |
1624 | |
1625 int mouse_cell_x = inventory_mouse_x / 32; | |
1626 int mouse_cell_y = inventory_mouse_y / 32; | |
1627 | |
1628 if (mouse_cell_x + mouse_cell_y < 0) | |
1629 return; | |
1630 | |
1631 int inventory_idx = mouse_cell_x + 14 * mouse_cell_y; | |
1632 if (inventory_idx > 126) | |
1633 return; | |
1634 | |
1635 if (pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx) == 0) | |
1636 return; | |
1637 | |
1638 item_pid = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx); | |
1639 } | |
1640 //check character condition(ïðîâåðêà ñîñòîÿíèÿ ïåðñîíàæà) | |
1641 if (!pPlayers[uActiveCharacter]->CanAct()) | |
1642 { | |
1643 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s íå â ñîñòîÿíèè %s Îïîçíàòü ïðåäìåòû | |
1644 message_window.Hint = pTmpBuf.data(); | |
1645 message_window.uFrameWidth = 384; | |
1646 message_window.uFrameHeight = 180; | |
1647 if (cursor.x <= 320 ) | |
1648 message_window.uFrameX = cursor.x + 30; | |
1649 else | |
1650 message_window.uFrameX = cursor.x - 414; | |
1651 message_window.uFrameY = 40; | |
1652 message_window.DrawMessageBox(0); | |
1653 return; | |
1654 } | |
1655 | |
1656 int alchemy_skill_points = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY) & 0x3F; | |
1657 int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY)); | |
1658 | |
1659 // for potion bottle(ïðîñòàÿ áóòûëêà) | |
1660 if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) | |
1661 { | |
1662 GameUI_DrawItemInfo(item); | |
1663 return; | |
1664 } | |
1665 //for recharge potion(çåëüå ïåðåçàðÿäêà) | |
1666 if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) | |
1667 { | |
1668 if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION)// all potions | |
1669 { | |
1670 if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands | |
1671 { | |
1672 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
1673 return; | |
1674 } | |
1675 | |
1676 v31 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; | |
1677 if ( v31 < 0.0 ) | |
1678 v31 = 0.0; | |
1679 item->uMaxCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); | |
1680 item->uNumCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); | |
1681 | |
1682 pMouse->RemoveHoldingItem(); | |
1683 no_rightlick_in_inventory = 1; | |
1684 return; | |
1685 } | |
1686 GameUI_DrawItemInfo(item); | |
1687 return; | |
1688 } | |
1689 // for harden potion(çåëüå çàêàëêà) | |
1690 else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) | |
1691 { | |
1692 if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // bottle and all potions | |
1693 { | |
1694 if (item->IsBroken() || // cant harden broken items | |
1695 item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts | |
1696 item->GetItemEquipType() < EQUIP_SINGLE_HANDED || | |
1697 item->GetItemEquipType() > EQUIP_WAND) | |
1698 { | |
1699 pMouse->RemoveHoldingItem(); | |
1700 no_rightlick_in_inventory = true; | |
1701 return; | |
1702 } | |
1703 | |
1704 item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; | |
1705 | |
1706 _50C9A8_item_enchantment_timer = 256; | |
1707 pMouse->RemoveHoldingItem(); | |
1708 no_rightlick_in_inventory = true; | |
1709 return; | |
1710 } | |
1711 GameUI_DrawItemInfo(item); | |
1712 return; | |
1713 } | |
1714 // several potions(íåñêîëüêî çåëèé) | |
1715 else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || | |
1716 pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) | |
1717 { | |
1718 if ( item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // all potions | |
1719 { | |
1720 if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || | |
1721 item->uItemID >= ITEM_ARTIFACT_PUCK || | |
1722 item->IsBroken() || | |
1723 item->uSpecEnchantmentType || | |
1724 item->uEnchantmentType || | |
1725 item->GetItemEquipType() >= EQUIP_ARMOUR) // only melee weapons and bows | |
1726 { | |
1727 pMouse->RemoveHoldingItem(); | |
1728 no_rightlick_in_inventory = true; | |
1729 return; | |
1730 } | |
1731 | |
1732 item->UpdateTempBonus(pParty->uTimePlayed); | |
1733 if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) | |
1734 { | |
1735 item->uSpecEnchantmentType = 40; // of Slaying | |
1736 v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); | |
1737 } | |
1738 else | |
1739 { | |
1740 static int _4E2904_enchantment_by_potion_lut[] = | |
1741 { | |
1742 164, 93, 22, | |
1743 164, 93, 22, | |
1744 11, 5, 13, 7, 59 | |
1745 }; | |
1746 item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; | |
1747 v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); | |
1748 } | |
1749 | |
1750 item->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; | |
1751 item->uAttributes = alchemy_skill_level | 0x18; | |
1752 | |
1753 _50C9A8_item_enchantment_timer = 256; | |
1754 pMouse->RemoveHoldingItem(); | |
1755 no_rightlick_in_inventory = true; | |
1756 return; | |
1757 } | |
1758 GameUI_DrawItemInfo(item); | |
1759 return; | |
1760 } | |
1761 // use reagents(ïðèìåíåíèå ðåàãåíòîâ) | |
1762 if (pParty->pPickedItem.uItemID >= ITEM_REAGENT_WIDOWSWEEP_BERRIES && pParty->pPickedItem.uItemID <= ITEM_REAGENT_PHILOSOPHERS_STONE && | |
1763 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == ITEM_POTION_BOTTLE) | |
1764 { | |
1765 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = alchemy_skill_points + pParty->pPickedItem.GetDamageDice(); | |
1766 switch ( pParty->pPickedItem.uItemID ) | |
1767 { | |
1768 case 200: | |
1769 case 201: | |
1770 case 202: | |
1771 case 203: | |
1772 case 204: | |
1773 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 222; | |
1774 break; | |
1775 case 205: | |
1776 case 206: | |
1777 case 207: | |
1778 case 208: | |
1779 case 209: | |
1780 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 223; | |
1781 break; | |
1782 case 210: | |
1783 case 211: | |
1784 case 212: | |
1785 case 213: | |
1786 case 214: | |
1787 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 224; | |
1788 break; | |
1789 case 215: | |
1790 case 216: | |
1791 case 217: | |
1792 case 218: | |
1793 case 219: | |
1794 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 221; | |
1795 break; | |
1796 default: | |
1797 break; | |
1798 } | |
1799 pMouse->RemoveHoldingItem(); | |
1800 no_rightlick_in_inventory = 1; | |
1801 if ( dword_4E455C ) | |
1802 { | |
1803 pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); | |
1804 dword_4E455C = 0; | |
1805 } | |
1806 return; | |
1807 } | |
1808 //potions mixing(ñìåøèâàíèå äâóõ çåëèé) | |
1809 if (pParty->pPickedItem.uItemID >= ITEM_POTION_CATALYST && pParty->pPickedItem.uItemID <= ITEM_POTION_REJUVENATION && | |
1810 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID >= ITEM_POTION_CATALYST && | |
1811 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID <= ITEM_POTION_REJUVENATION) | |
1812 { | |
1813 potion1_id = item->uItemID - ITEM_POTION_CURE_WOUNDS; | |
1814 potion2_id = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; | |
1815 | |
1816 if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || item->uItemID == ITEM_POTION_CATALYST ) | |
1817 potionID = 5; | |
1818 else | |
1819 potionID = pItemsTable->potion_data[potion2_id][potion1_id]; | |
1820 damage_level = 0; | |
1821 if ( alchemy_skill_points ) | |
1822 { | |
1823 if ( potionID < ITEM_POTION_CURE_DISEASE || potionID > ITEM_POTION_AWAKEN )//< 225 >227 | |
1824 { | |
1825 if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY && alchemy_skill_level == 1)//228 >= potionID <= 239 | |
1826 damage_level = 2; | |
1827 if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE && alchemy_skill_level <= 2)//240 >= potionID <= 261 | |
1828 damage_level = 3; | |
1829 if ( potionID >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_level <= 3 )// 262 < potionID | |
1830 damage_level = 4; | |
1831 } | |
1832 } | |
1833 else//no skill(íåò íàâûêà) | |
1834 { | |
1835 if ( potionID >= ITEM_POTION_CURE_DISEASE && potionID <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227 | |
1836 damage_level = 1; | |
1837 if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239 | |
1838 damage_level = 2; | |
1839 if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261 | |
1840 damage_level = 3; | |
1841 if ( potionID >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16 | |
1842 damage_level = 4; | |
1843 } | |
1844 | |
1845 int pOut_x = item_pid + 1; | |
1846 for ( uint i = 0; i < 126; ++i ) | |
1847 { | |
1848 if ( pPlayers[uActiveCharacter]->pInventoryMatrix[i] == pOut_x ) | |
1849 { | |
1850 pOut_y = i; | |
1851 break; | |
1852 } | |
1853 } | |
1854 if ( !potionID ) | |
1855 { | |
1856 GameUI_DrawItemInfo(item); | |
1857 return; | |
1858 } | |
1859 if ( damage_level == 1 ) | |
1860 { | |
1861 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); | |
1862 pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE); | |
2534 | 1863 pAudioPlayer->PlaySound(SOUND_fireBall, 0, 0, -1, 0, 0, 0, 0); |
2501 | 1864 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); |
1865 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
1866 v39.x = pParty->vPosition.x; | |
1867 v39.y = pParty->vPosition.y; | |
1868 | |
1869 int rot_x, rot_y, rot_z; | |
1870 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); | |
1871 SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); | |
1872 if ( dword_4E455C ) | |
1873 { | |
1874 if ( pPlayers[uActiveCharacter]->CanAct() ) | |
1875 pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); | |
1876 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Îé! | |
1877 dword_4E455C = 0; | |
1878 } | |
1879 pMouse->RemoveHoldingItem(); | |
1880 no_rightlick_in_inventory = 1; | |
1881 return; | |
1882 } | |
1883 if ( damage_level == 2 ) | |
1884 { | |
1885 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); | |
1886 pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE); | |
1887 pPlayers[uActiveCharacter]->ItemsEnchant(1); | |
2534 | 1888 pAudioPlayer->PlaySound(SOUND_fireBall, 0, 0, -1, 0, 0, 0, 0); |
2501 | 1889 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); |
1890 | |
1891 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
1892 v39.x = pParty->vPosition.x; | |
1893 v39.y = pParty->vPosition.y; | |
1894 | |
1895 int rot_x, rot_y, rot_z; | |
1896 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); | |
1897 SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); | |
1898 if ( dword_4E455C ) | |
1899 { | |
1900 if ( pPlayers[uActiveCharacter]->CanAct() ) | |
1901 pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); | |
1902 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Îé! | |
1903 dword_4E455C = 0; | |
1904 } | |
1905 pMouse->RemoveHoldingItem(); | |
1906 no_rightlick_in_inventory = 1; | |
1907 return; | |
1908 } | |
1909 if ( damage_level == 3 ) | |
1910 { | |
1911 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); | |
1912 pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 201 + 50, DMGT_FIRE); | |
1913 pPlayers[uActiveCharacter]->ItemsEnchant(5); | |
2534 | 1914 pAudioPlayer->PlaySound(SOUND_fireBall, 0, 0, -1, 0, 0, 0, 0); |
2501 | 1915 |
1916 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1917 | |
1918 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
1919 v39.x = pParty->vPosition.x; | |
1920 v39.y = pParty->vPosition.y; | |
1921 | |
1922 int rot_x, rot_y, rot_z; | |
1923 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); | |
1924 SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); | |
1925 if ( dword_4E455C ) | |
1926 { | |
1927 if ( pPlayers[uActiveCharacter]->CanAct() ) | |
1928 pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); | |
1929 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Îé! | |
1930 dword_4E455C = 0; | |
1931 } | |
1932 pMouse->RemoveHoldingItem(); | |
1933 no_rightlick_in_inventory = 1; | |
1934 return; | |
1935 } | |
1936 if ( damage_level == 4 ) | |
1937 { | |
1938 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); | |
1939 pPlayers[uActiveCharacter]->SetCondition(Condition_Eradicated, 0); | |
1940 pPlayers[uActiveCharacter]->ItemsEnchant(0); | |
2534 | 1941 pAudioPlayer->PlaySound(SOUND_fireBall, 0, 0, -1, 0, 0, 0, 0); |
2501 | 1942 |
1943 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1944 | |
1945 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
1946 v39.x = pParty->vPosition.x; | |
1947 v39.y = pParty->vPosition.y; | |
1948 | |
1949 int rot_x, rot_y, rot_z; | |
1950 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); | |
1951 SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); | |
1952 if ( dword_4E455C ) | |
1953 { | |
1954 if ( pPlayers[uActiveCharacter]->CanAct() ) | |
1955 pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); | |
1956 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Îé! | |
1957 dword_4E455C = 0; | |
1958 } | |
1959 pMouse->RemoveHoldingItem(); | |
1960 no_rightlick_in_inventory = 1; | |
1961 return; | |
1962 } | |
1963 if ( damage_level == 0 ) | |
1964 { | |
1965 if ( alchemy_skill_points ) | |
1966 { | |
1967 if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 || pParty->pPickedItem.uItemID == 221 )//catalyst(êàòàëèçàòîð) | |
1968 { | |
1969 if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 ) | |
1970 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = pParty->pPickedItem.uItemID; | |
1971 if ( pParty->pPickedItem.uItemID == 221 ) | |
1972 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = pParty->pPickedItem.uEnchantmentType; | |
1973 } | |
1974 else | |
1975 { | |
1976 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = potionID; | |
1977 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType | |
1978 + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) / 2; | |
1979 pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, pItemsTable->potion_note[potion1_id][potion2_id]); | |
1980 } | |
1981 int bottle = pPlayers[uActiveCharacter]->AddItem(-1, 220);//áóòûëêà | |
1982 if ( bottle ) | |
1983 pPlayers[uActiveCharacter]->pOwnItems[bottle - 1].uAttributes = ITEM_IDENTIFIED; | |
1984 if ( !(pItemsTable->pItems[pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID].uItemID_Rep_St) ) | |
1985 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uAttributes |= 1; | |
1986 if ( !dword_4E455C ) | |
1987 { | |
1988 pMouse->RemoveHoldingItem(); | |
1989 no_rightlick_in_inventory = 1; | |
1990 return; | |
1991 } | |
1992 pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); | |
1993 dword_4E455C = 0; | |
1994 pMouse->RemoveHoldingItem(); | |
1995 no_rightlick_in_inventory = 1; | |
1996 return; | |
1997 } | |
1998 GameUI_DrawItemInfo(item); | |
1999 return; | |
2000 } | |
2001 } | |
2002 GameUI_DrawItemInfo(item); | |
2003 return; | |
2004 } | |
2005 | |
2006 | |
2007 //----- (0045828B) -------------------------------------------------------- | |
2008 unsigned int __fastcall GetSpellColor(signed int a1) | |
2009 { | |
2010 if ( a1 == 0 ) | |
2011 return Color16(0, 0, 0); | |
2012 if ( a1 < 12 ) | |
2013 return Color16(255, 85, 0); | |
2014 if ( a1 < 23 ) | |
2015 return Color16(150, 212, 255); | |
2016 if ( a1 < 34 ) | |
2017 return Color16(0, 128, 255); | |
2018 if ( a1 < 45 ) | |
2019 return Color16(128, 128, 128); | |
2020 if ( a1 < 56 ) | |
2021 return Color16(225, 225, 225); | |
2022 if ( a1 < 67 ) | |
2023 return Color16(235, 15, 255); | |
2024 if ( a1 < 78 ) | |
2025 return Color16(255, 128, 0); | |
2026 if ( a1 < 89 ) | |
2027 return Color16(255, 255, 155); | |
2028 if ( a1 < 100 ) | |
2029 return Color16(192, 192, 240); | |
2030 else | |
2031 __debugbreak(); | |
2032 } | |
2033 | |
2034 //----- (004B46F8) -------------------------------------------------------- | |
2035 __int64 GetExperienceRequiredForLevel(int level) | |
2036 { | |
2037 __int64 v1; // eax@1 | |
2038 int i; // edx@1 | |
2039 | |
2040 v1 = 0; | |
2041 for (i = 0; i < level; ++i) | |
2042 v1 += i + 1; | |
2043 return 1000 * v1; | |
2044 } |