comparison UI/UIPopup.cpp @ 1709:8251e59fd7c1

ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
author Grumpy7
date Tue, 24 Sep 2013 07:29:55 +0200
parents 33c7cc2d48d5
children 0f6cd60ca987
comparison
equal deleted inserted replaced
1708:f8414042db1f 1709:8251e59fd7c1
133 if ( pMouse->GetCursorPos(&a2)->x <= 320 ) 133 if ( pMouse->GetCursorPos(&a2)->x <= 320 )
134 v2 = pMouse->GetCursorPos(&a2)->x + 30; 134 v2 = pMouse->GetCursorPos(&a2)->x + 30;
135 else 135 else
136 v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30; 136 v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30;
137 iteminfo_window.uFrameX = v2; 137 iteminfo_window.uFrameX = v2;
138 v78 = 100 - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureWidth; 138 v78 = 100 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureWidth;
139 v81 = 144 - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureHeight; 139 v81 = 144 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight;
140 if ( v78 > 0 ) 140 if ( v78 > 0 )
141 v78 = v78 / 2; 141 v78 = v78 / 2;
142 if ( v81 <= 0 ) 142 if ( v81 <= 0 )
143 v81 = 0; 143 v81 = 0;
144 else 144 else
145 v81 = v81 / 2; 145 v81 = v81 / 2;
146 if ( !pItemsTable->pItems[inspect_item->uItemID].uItemID_Rep_St ) 146 if ( !pItemsTable->pItems[inspect_item->uItemID].uItemID_Rep_St )
147 inspect_item->SetIdentified(); 147 inspect_item->SetIdentified();
148 v77 = 0; 148 v77 = 0;
149 if (pItemsTable->pItems[inspect_item->uItemID].uEquipType == EQUIP_GOLD) 149 if (inspect_item->GetItemEquipType() == EQUIP_GOLD)
150 v77 = inspect_item->uSpecEnchantmentType; 150 v77 = inspect_item->uSpecEnchantmentType;
151 if ( uActiveCharacter ) 151 if ( uActiveCharacter )
152 { 152 {
153 //try to identify 153 //try to identify
154 if (!inspect_item->IsIdentified()) 154 if (!inspect_item->IsIdentified())
196 iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); 196 iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
197 iteminfo_window.uFrameWidth -= 24; 197 iteminfo_window.uFrameWidth -= 24;
198 iteminfo_window.uFrameHeight -= 12; 198 iteminfo_window.uFrameHeight -= 12;
199 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; 199 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
200 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; 200 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
201 pRenderer->DrawTransparentRedShade(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)); 201 pRenderer->DrawTransparentRedShade(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
202 if ( inspect_item->IsIdentified()) 202 if ( inspect_item->IsIdentified())
203 pText = (char *)inspect_item->GetIdentifiedName(); 203 pText = (char *)inspect_item->GetIdentifiedName();
204 else 204 else
205 pText = pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName; 205 pText = pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName;
206 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), pText, 3); 206 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), pText, 3);
207 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2, 207 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2,
208 TargetColor(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item" 208 TargetColor(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item"
209 pRenderer->ResetTextureClipRect(); 209 pRenderer->ResetTextureClipRect();
210 if ( !areWeLoadingTexture ) 210 if ( !areWeLoadingTexture )
211 { 211 {
212 pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release(); 212 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
213 pIcons_LOD->SyncLoadedFilesCount(); 213 pIcons_LOD->SyncLoadedFilesCount();
214 } 214 }
215 return; 215 return;
216 } 216 }
217 if (!inspect_item->IsIdentified()) 217 if (!inspect_item->IsIdentified())
221 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); 221 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
222 iteminfo_window.uFrameWidth -= 24; 222 iteminfo_window.uFrameWidth -= 24;
223 iteminfo_window.uFrameHeight -= 12; 223 iteminfo_window.uFrameHeight -= 12;
224 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; 224 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
225 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; 225 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
226 pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)); 226 pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
227 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3); 227 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3);
228 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2, 228 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2,
229 TargetColor(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified" 229 TargetColor(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified"
230 pRenderer->ResetTextureClipRect(); 230 pRenderer->ResetTextureClipRect();
231 if ( !areWeLoadingTexture ) 231 if ( !areWeLoadingTexture )
232 { 232 {
233 pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release(); 233 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
234 pIcons_LOD->SyncLoadedFilesCount(); 234 pIcons_LOD->SyncLoadedFilesCount();
235 } 235 }
236 return; 236 return;
237 } 237 }
238 sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName); //"Type: %s" 238 sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName); //"Type: %s"
239 out_text[100] = 0; 239 out_text[100] = 0;
240 out_text[200] = 0; 240 out_text[200] = 0;
241 switch (pItemsTable->pItems[inspect_item->uItemID].uEquipType) 241 switch (inspect_item->GetItemEquipType())
242 { 242 {
243 case EQUIP_OFF_HAND: 243 case EQUIP_OFF_HAND:
244 case EQUIP_MAIN_HAND: 244 case EQUIP_MAIN_HAND:
245 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK], 245 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK],
246 (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod, pGlobalTXT_LocalizationStrings[53], 246 (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53],
247 (int)pItemsTable->pItems[inspect_item->uItemID].uDamageDice, (int)pItemsTable->pItems[inspect_item->uItemID].uDamageRoll); //"Damage" 247 (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); //"Damage"
248 if (pItemsTable->pItems[inspect_item->uItemID].uDamageMod) 248 if (inspect_item->GetDamageMod())
249 { 249 {
250 char mod[16]; 250 char mod[16];
251 sprintf(mod, "+%d", (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod); 251 sprintf(mod, "+%d", (int)inspect_item->GetDamageMod());
252 strcat(out_text + 100, mod); 252 strcat(out_text + 100, mod);
253 } 253 }
254 break; 254 break;
255 255
256 case EQUIP_BOW: 256 case EQUIP_BOW:
257 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot" 257 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot"
258 (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod, pGlobalTXT_LocalizationStrings[53], //"Damage" 258 (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], //"Damage"
259 (int)pItemsTable->pItems[inspect_item->uItemID].uDamageDice, (int)pItemsTable->pItems[inspect_item->uItemID].uDamageRoll); 259 (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll());
260 if (pItemsTable->pItems[inspect_item->uItemID].uDamageMod) 260 if (inspect_item->GetDamageMod())
261 { 261 {
262 char mod[16]; 262 char mod[16];
263 sprintf(mod, "+%d", (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod); 263 sprintf(mod, "+%d", (int)inspect_item->GetDamageMod());
264 strcat(out_text + 100, mod); 264 strcat(out_text + 100, mod);
265 } 265 }
266 break; 266 break;
267 267
268 case EQUIP_ARMOUR: 268 case EQUIP_ARMOUR:
272 case EQUIP_CLOAK: 272 case EQUIP_CLOAK:
273 case EQUIP_GAUNTLETS: 273 case EQUIP_GAUNTLETS:
274 case EQUIP_BOOTS: 274 case EQUIP_BOOTS:
275 case EQUIP_RING: 275 case EQUIP_RING:
276 case EQUIP_AMULET: 276 case EQUIP_AMULET:
277 if (pItemsTable->pItems[inspect_item->uItemID].uDamageDice) //"Armor" 277 if (inspect_item->GetDamageDice()) //"Armor"
278 sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], 278 sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11],
279 pItemsTable->pItems[inspect_item->uItemID].uDamageDice + pItemsTable->pItems[inspect_item->uItemID].uDamageMod); 279 inspect_item->GetDamageDice() + inspect_item->GetDamageMod());
280 break; 280 break;
281 } 281 }
282 282
283 if ( !v77 ) 283 if ( !v77 )
284 { 284 {
285 if (pItemsTable->pItems[inspect_item->uItemID].uEquipType ==EQUIP_POTION) //this is CORRECT! do not move to switch! 285 if (inspect_item->GetItemEquipType() ==EQUIP_POTION) //this is CORRECT! do not move to switch!
286 { 286 {
287 if ( inspect_item->uEnchantmentType ) 287 if ( inspect_item->uEnchantmentType )
288 sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power" 288 sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power"
289 } 289 }
290 else if (pItemsTable->pItems[inspect_item->uItemID].uEquipType == EQUIP_REAGENT) 290 else if (inspect_item->GetItemEquipType() == EQUIP_REAGENT)
291 sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power" 291 sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], inspect_item->GetDamageDice()); //"Power"
292 else if ( inspect_item->uEnchantmentType ) 292 else if ( inspect_item->uEnchantmentType )
293 sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->m_enchantmentStrength); //"Special" 293 sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->m_enchantmentStrength); //"Special"
294 else if ( inspect_item->uSpecEnchantmentType ) 294 else if ( inspect_item->uSpecEnchantmentType )
295 sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement, inspect_item->m_enchantmentStrength); 295 sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement, inspect_item->m_enchantmentStrength);
296 else if ( inspect_item->uNumCharges ) 296 else if ( inspect_item->uNumCharges )
308 v84 += 100; 308 v84 += 100;
309 } 309 }
310 v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription; 310 v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription;
311 if ( *v28 ) 311 if ( *v28 )
312 Str += pFontSmallnum->CalcTextHeight(pItemsTable->pItems[inspect_item->uItemID].pDescription, &iteminfo_window, 100, 0); 312 Str += pFontSmallnum->CalcTextHeight(pItemsTable->pItems[inspect_item->uItemID].pDescription, &iteminfo_window, 100, 0);
313 iteminfo_window.uFrameHeight = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, 313 iteminfo_window.uFrameHeight = pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(),
314 TEXTURE_16BIT_PALETTE)->uTextureHeight + v81 + 54; 314 TEXTURE_16BIT_PALETTE)->uTextureHeight + v81 + 54;
315 if ( (signed int)Str > (signed int)iteminfo_window.uFrameHeight ) 315 if ( (signed int)Str > (signed int)iteminfo_window.uFrameHeight )
316 iteminfo_window.uFrameHeight = (unsigned int)Str; 316 iteminfo_window.uFrameHeight = (unsigned int)Str;
317 if ( inspect_item->uAttributes & 8 && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) ) 317 if ( inspect_item->uAttributes & 8 && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
318 iteminfo_window.uFrameHeight += LOBYTE(pFontComic->uFontHeight); 318 iteminfo_window.uFrameHeight += LOBYTE(pFontComic->uFontHeight);
335 //v32 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureHeight; 335 //v32 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureHeight;
336 iteminfo_window.uFrameHeight -= 12; 336 iteminfo_window.uFrameHeight -= 12;
337 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; 337 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
338 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; 338 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
339 pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, 339 pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78,
340 iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2, 340 iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2,
341 pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)); 341 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
342 342
343 v34 = (int)(v85 + 35); 343 v34 = (int)(v85 + 35);
344 Str = out_text; 344 Str = out_text;
345 for ( uint i = 1; i <= 3; i++ ) 345 for ( uint i = 1; i <= 3; i++ )
346 { 346 {
401 if ( !(BYTE1(inspect_item->uAttributes) & 2) ) 401 if ( !(BYTE1(inspect_item->uAttributes) & 2) )
402 { 402 {
403 pRenderer->ResetTextureClipRect(); 403 pRenderer->ResetTextureClipRect();
404 if ( !areWeLoadingTexture ) 404 if ( !areWeLoadingTexture )
405 { 405 {
406 pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release(); 406 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
407 pIcons_LOD->SyncLoadedFilesCount(); 407 pIcons_LOD->SyncLoadedFilesCount();
408 } 408 }
409 return; 409 return;
410 } 410 }
411 pText = pGlobalTXT_LocalizationStrings[651]; //"Hardened" 411 pText = pGlobalTXT_LocalizationStrings[651]; //"Hardened"
415 iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), inspect_item->uAttributes, pText, 0, 0, 0); 415 iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), inspect_item->uAttributes, pText, 0, 0, 0);
416 pRenderer->ResetTextureClipRect(); 416 pRenderer->ResetTextureClipRect();
417 } 417 }
418 if ( !areWeLoadingTexture ) 418 if ( !areWeLoadingTexture )
419 { 419 {
420 pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release(); 420 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
421 pIcons_LOD->SyncLoadedFilesCount(); 421 pIcons_LOD->SyncLoadedFilesCount();
422 } 422 }
423 return; 423 return;
424 } 424 }
425 // 4E455C: using guessed type int dword_4E455C; 425 // 4E455C: using guessed type int dword_4E455C;