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