comparison Chest.cpp @ 945:0d96349d8c87

Restoring inlined methods
author Nomad
date Wed, 01 May 2013 14:09:49 +0200
parents ceef50611567
children 5a2dbb00c399
comparison
equal deleted inserted replaced
940:4dd4184d4248 945:0d96349d8c87
240 dword_507CD8 = 0; 240 dword_507CD8 = 0;
241 241
242 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Chest, uChestID, 0); 242 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Chest, uChestID, 0);
243 pChestWindow = pGUIWindow_CurrentMenu; 243 pChestWindow = pGUIWindow_CurrentMenu;
244 pBtn_ExitCancel = pChestWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79],// Exit 244 pBtn_ExitCancel = pChestWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79],// Exit
245 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); 245 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
246 pChestWindow->CreateButton(7u, 8u, 460u, 343u, 1, 0, UIMSG_C, 0, 0, "", 0); 246 pChestWindow->CreateButton(7u, 8u, 460u, 343u, 1, 0, UIMSG_C, 0, 0, "", 0);
247 pCurrentScreen = SCREEN_CHEST; 247 pCurrentScreen = SCREEN_CHEST;
248 pEventTimer->Pause(); 248 pEventTimer->Pause();
249 return 1; 249 return 1;
250 } 250 }
280 chest_offs_y = pChestPixelOffsetY[chestBitmapId]; 280 chest_offs_y = pChestPixelOffsetY[chestBitmapId];
281 chestWidthCells = pChestWidthsByType[chestBitmapId]; 281 chestWidthCells = pChestWidthsByType[chestBitmapId];
282 chestHeghtCells = pChestHeightsByType[chestBitmapId]; 282 chestHeghtCells = pChestHeightsByType[chestBitmapId];
283 sprintf(pTmpBuf, "chest%02d", pChestList->pChests[chestBitmapId].uTextureID); 283 sprintf(pTmpBuf, "chest%02d", pChestList->pChests[chestBitmapId].uTextureID);
284 v5 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE); 284 v5 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE);
285 pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0)); 285 pRenderer->DrawTextureIndexed(8u, 8u, pIcons_LOD->GetTexture(v5));
286 286
287 for (item_counter = 0; item_counter< chestWidthCells * chestHeghtCells; ++item_counter) 287 for (item_counter = 0; item_counter< chestWidthCells * chestHeghtCells; ++item_counter)
288 { 288 {
289 chest_item_index = pChests[uChestID].pInventoryIndices[item_counter]; 289 chest_item_index = pChests[uChestID].pInventoryIndices[item_counter];
290 if ( chest_item_index > 0 ) 290 if ( chest_item_index > 0 )
291 { 291 {
292 item_texture_id = pIcons_LOD->LoadTexture( 292 item_texture_id = pIcons_LOD->LoadTexture(
293 //pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName, 293 //pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName,
294 pItemsTable->pItems[pChests[uChestID].igChestItems[chest_item_index-1].uItemID].pIconName, TEXTURE_16BIT_PALETTE); 294 pItemsTable->pItems[pChests[uChestID].igChestItems[chest_item_index-1].uItemID].pIconName, TEXTURE_16BIT_PALETTE);
295 item_texture = (Texture *)(item_texture_id != -1 ? &pIcons_LOD->pTextures[item_texture_id] : 0); 295 item_texture = pIcons_LOD->GetTexture(item_texture_id);
296 itemPixelWidth = (item_texture_id != -1 ? pIcons_LOD->pTextures[item_texture_id].uTextureWidth : 24); 296 itemPixelWidth = item_texture->uTextureWidth;
297 itemPixelHeght = (item_texture_id != -1 ? pIcons_LOD->pTextures[item_texture_id].uTextureHeight : 26); 297 itemPixelHeght = item_texture->uTextureHeight;
298 if ( itemPixelWidth < 14 ) 298 if ( itemPixelWidth < 14 )
299 itemPixelWidth = 14; 299 itemPixelWidth = 14;
300 v12 = itemPixelWidth - 14; 300 v12 = itemPixelWidth - 14;
301 v12 = v12 & 0xFFFFFFE0; 301 v12 = v12 & 0xFFFFFFE0;
302 v13 = v12 + 32; 302 v13 = v12 + 32;
307 ((signed int)(((itemPixelHeght - 14) & 0xFFFFFFE0) + 32- item_texture->uTextureHeight ) /2); 307 ((signed int)(((itemPixelHeght - 14) & 0xFFFFFFE0) + 32- item_texture->uTextureHeight ) /2);
308 pRenderer->DrawTextureTransparent( itemPixelPosX, itemPixelPosY, item_texture); 308 pRenderer->DrawTextureTransparent( itemPixelPosX, itemPixelPosY, item_texture);
309 sub_40F92A(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1); 309 sub_40F92A(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1);
310 } 310 }
311 } 311 }
312 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, 312 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId));
313 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0));
314 } 313 }
315 314
316 315
317 //----- (0041FE71) -------------------------------------------------------- 316 //----- (0041FE71) --------------------------------------------------------
318 bool Chest::CanPlaceItemAt( signed int test_cell_position, int item_id, signed int uChestID ) 317 bool Chest::CanPlaceItemAt( signed int test_cell_position, int item_id, signed int uChestID )
334 signed int chest_cell_width; // [sp+14h] [bp-4h]@1 333 signed int chest_cell_width; // [sp+14h] [bp-4h]@1
335 334
336 chest_cell_heght = pChestHeightsByType[pChests[uChestID].uChestBitmapID]; 335 chest_cell_heght = pChestHeightsByType[pChests[uChestID].uChestBitmapID];
337 chest_cell_width = pChestWidthsByType[pChests[uChestID].uChestBitmapID]; 336 chest_cell_width = pChestWidthsByType[pChests[uChestID].uChestBitmapID];
338 item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_id].pIconName, TEXTURE_16BIT_PALETTE); 337 item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_id].pIconName, TEXTURE_16BIT_PALETTE);
339 item_texture = (Texture *)(item_texture_id != -1 ? (int)&pIcons_LOD->pTextures[item_texture_id] : 0); 338 item_texture = pIcons_LOD->GetTexture(item_texture_id);
340 v6 = (item_texture_id != -1 ? pIcons_LOD->pTextures[item_texture_id].uTextureWidth : 24); 339 v6 = item_texture->uTextureWidth;
341 if ( v6 < 14 ) 340 if ( v6 < 14 )
342 v6 = 14; 341 v6 = 14;
343 texture_cell_width = (v6 - 14 >> 5) + 1; 342 texture_cell_width = (v6 - 14 >> 5) + 1;
344 v8 = item_texture->uTextureHeight; 343 v8 = item_texture->uTextureHeight;
345 if ( v8 < 14 ) 344 if ( v8 < 14 )
415 ItemGen *v4; // edi@1 414 ItemGen *v4; // edi@1
416 int v5; // esi@1 415 int v5; // esi@1
417 int result; // eax@11 416 int result; // eax@11
418 unsigned int v7; // eax@12 417 unsigned int v7; // eax@12
419 int v8; // edx@12 418 int v8; // edx@12
420 int v9; // ecx@12 419 Texture *v9; // ecx@12
421 signed int v10; // eax@12 420 signed int v10; // eax@12
422 signed int v11; // edi@14 421 signed int v11; // edi@14
423 unsigned int v12; // esi@14 422 unsigned int v12; // esi@14
424 int v13; // edi@16 423 int v13; // edi@16
425 void *v14; // edi@21 424 void *v14; // edi@21
462 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); 461 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
463 return 0; 462 return 0;
464 } 463 }
465 v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4->uItemID].pIconName, TEXTURE_16BIT_PALETTE); 464 v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
466 HIWORD(v8) = 0; 465 HIWORD(v8) = 0;
467 v9 = v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0; 466 v9 = pIcons_LOD->GetTexture(v7);
468 v10 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); 467 v10 = v9->uTextureWidth;
469 if ( v10 < 14 ) 468 if ( v10 < 14 )
470 v10 = 14; 469 v10 = 14;
471 v11 = *(short *)(v9 + 26); 470 v11 = v9->uTextureHeight;
472 v12 = ((v10 - 14) >> 5) + 1; 471 v12 = ((v10 - 14) >> 5) + 1;
473 if ( v11 < 14 ) 472 if ( v11 < 14 )
474 v11 = 14; 473 v11 = 14;
475 v13 = ((v11 - 14) >> 5) + 1; 474 v13 = ((v11 - 14) >> 5) + 1;
476 if ( !areWeLoadingTexture ) 475 if ( !areWeLoadingTexture )
537 v6 = rand() % 21 + 10; 536 v6 = rand() % 21 + 10;
538 pChests[ uChestID].igChestItems[item_at_cell].uNumCharges = v6; 537 pChests[ uChestID].igChestItems[item_at_cell].uNumCharges = v6;
539 pChests[ uChestID].igChestItems[item_at_cell].uMaxCharges = v6; 538 pChests[ uChestID].igChestItems[item_at_cell].uMaxCharges = v6;
540 } 539 }
541 v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); 540 v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
542 v8 = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0); 541 v8 = pIcons_LOD->GetTexture(v7);
543 v9 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); 542 v9 = v8->uTextureWidth;
544 if ( v9 < 14 ) 543 if ( v9 < 14 )
545 v9 = 14; 544 v9 = 14;
546 v10 = v8->uTextureHeight; 545 v10 = v8->uTextureHeight;
547 texture_cell_width = ((v9 - 14) >> 5) + 1; 546 texture_cell_width = ((v9 - 14) >> 5) + 1;
548 if ( v10 < 14 ) 547 if ( v10 < 14 )
771 //v3 = (ItemGen *)((char *)v2 + 36 * a1 + (int)((char *)pChests + 4)); 770 //v3 = (ItemGen *)((char *)v2 + 36 * a1 + (int)((char *)pChests + 4));
772 v3 = &pChests[v20].igChestItems[a1]; 771 v3 = &pChests[v20].igChestItems[a1];
773 //v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)]; 772 //v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)];
774 v17 = pChestWidthsByType[pChests[v20].uChestBitmapID]; 773 v17 = pChestWidthsByType[pChests[v20].uChestBitmapID];
775 v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v3->uItemID].pIconName, TEXTURE_16BIT_PALETTE); 774 v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v3->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
776 v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); 775 v5 = pIcons_LOD->GetTexture(v4);
777 v6 = (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureWidth : 24); 776 v6 = v5->uTextureWidth;
778 if ( v6 < 14 ) 777 if ( v6 < 14 )
779 v6 = 14; 778 v6 = 14;
780 v7 = v6 - 14; 779 v7 = v6 - 14;
781 v8 = v5->uTextureHeight; 780 v8 = v5->uTextureHeight;
782 v9 = (v7 >> 5) + 1; 781 v9 = (v7 >> 5) + 1;