Mercurial > mm7
comparison Engine/Objects/Chest.cpp @ 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
author | a.parshin |
---|---|
date | Wed, 09 Mar 2016 01:39:52 +0200 |
parents | dd36326a9994 |
children |
comparison
equal
deleted
inserted
replaced
2574:dd36326a9994 | 2575:a76d408c5132 |
---|---|
216 | 216 |
217 //----- (0041FE71) -------------------------------------------------------- | 217 //----- (0041FE71) -------------------------------------------------------- |
218 bool Chest::CanPlaceItemAt( signed int test_cell_position, int item_id, signed int uChestID ) | 218 bool Chest::CanPlaceItemAt( signed int test_cell_position, int item_id, signed int uChestID ) |
219 { | 219 { |
220 // int v3; // eax@1 | 220 // int v3; // eax@1 |
221 unsigned int item_texture_id; // eax@1 | 221 //unsigned int item_texture_id; // eax@1 |
222 Texture_MM7 *item_texture; // ecx@1 | 222 //Image *item_texture; // ecx@1 |
223 signed int v6; // eax@1 | 223 signed int v6; // eax@1 |
224 // signed int v7; // edi@3 | 224 // signed int v7; // edi@3 |
225 signed int v8; // eax@3 | 225 signed int v8; // eax@3 |
226 int texture_cell_width; // edi@3 | 226 int texture_cell_width; // edi@3 |
227 int texture_cell_height; // ebx@5 | 227 int texture_cell_height; // ebx@5 |
233 // signed int v17; // [sp+10h] [bp-8h]@1 | 233 // signed int v17; // [sp+10h] [bp-8h]@1 |
234 signed int chest_cell_width; // [sp+14h] [bp-4h]@1 | 234 signed int chest_cell_width; // [sp+14h] [bp-4h]@1 |
235 | 235 |
236 chest_cell_heght = pChestHeightsByType[pChests[uChestID].uChestBitmapID]; | 236 chest_cell_heght = pChestHeightsByType[pChests[uChestID].uChestBitmapID]; |
237 chest_cell_width = pChestWidthsByType[pChests[uChestID].uChestBitmapID]; | 237 chest_cell_width = pChestWidthsByType[pChests[uChestID].uChestBitmapID]; |
238 item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_id].pIconName, TEXTURE_16BIT_PALETTE); | 238 |
239 item_texture = pIcons_LOD->GetTexture(item_texture_id); | 239 auto item_texture = assets->GetImage_16BitColorKey(pItemsTable->pItems[item_id].pIconName, 0x7FF); |
240 v6 = item_texture->uTextureWidth; | 240 //item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_id].pIconName, TEXTURE_16BIT_PALETTE); |
241 //item_texture = pIcons_LOD->GetTexture(item_texture_id); | |
242 v6 = item_texture->GetWidth(); | |
241 if ( v6 < 14 ) | 243 if ( v6 < 14 ) |
242 v6 = 14; | 244 v6 = 14; |
243 texture_cell_width = ((v6 - 14) >> 5) + 1; | 245 texture_cell_width = ((v6 - 14) >> 5) + 1; |
244 v8 = item_texture->uTextureHeight; | 246 v8 = item_texture->GetHeight(); |
245 if ( v8 < 14 ) | 247 if ( v8 < 14 ) |
246 v8 = 14; | 248 v8 = 14; |
247 texture_cell_height = ((v8 - 14) >> 5) + 1; | 249 texture_cell_height = ((v8 - 14) >> 5) + 1; |
248 if ( !areWeLoadingTexture ) | 250 |
251 if (item_texture) | |
252 { | |
253 item_texture->Release(); | |
254 item_texture = nullptr; | |
255 } | |
256 /*if ( !areWeLoadingTexture ) | |
249 { | 257 { |
250 item_texture->Release(); | 258 item_texture->Release(); |
251 pIcons_LOD->SyncLoadedFilesCount(); | 259 pIcons_LOD->SyncLoadedFilesCount(); |
252 } | 260 }*/ |
261 | |
253 if ( (texture_cell_width + test_cell_position % chest_cell_width <= chest_cell_width) && | 262 if ( (texture_cell_width + test_cell_position % chest_cell_width <= chest_cell_width) && |
254 (texture_cell_height + test_cell_position / chest_cell_width <= chest_cell_heght) ) | 263 (texture_cell_height + test_cell_position / chest_cell_width <= chest_cell_heght) ) |
255 { //we not put over borders | 264 { //we not put over borders |
256 _row = 0; | 265 _row = 0; |
257 if ( texture_cell_height <= 0 ) | 266 if ( texture_cell_height <= 0 ) |
310 int Chest::PutItemInChest(int position, ItemGen *put_item, signed int uChestID) | 319 int Chest::PutItemInChest(int position, ItemGen *put_item, signed int uChestID) |
311 {//(rus: положить предмет в ящик) | 320 {//(rus: положить предмет в ящик) |
312 ItemGen *v4; // edi@1 | 321 ItemGen *v4; // edi@1 |
313 int v5; // esi@1 | 322 int v5; // esi@1 |
314 int result; // eax@11 | 323 int result; // eax@11 |
315 unsigned int v7; // eax@12 | 324 //unsigned int v7; // eax@12 |
316 int v8; // edx@12 | 325 int v8; // edx@12 |
317 Texture_MM7 *texture; // ecx@12 | 326 //Texture_MM7 *texture; // ecx@12 |
318 signed int v10; // eax@12 | 327 signed int v10; // eax@12 |
319 signed int v11; // edi@14 | 328 signed int v11; // edi@14 |
320 unsigned int v12; // esi@14 | 329 unsigned int v12; // esi@14 |
321 int v13; // edi@16 | 330 int v13; // edi@16 |
322 void *v14; // edi@21 | 331 void *v14; // edi@21 |
349 { | 358 { |
350 if ( uActiveCharacter ) | 359 if ( uActiveCharacter ) |
351 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); | 360 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
352 return 0; | 361 return 0; |
353 } | 362 } |
354 v7 = pIcons_LOD->LoadTexture(v4->GetIconName(), TEXTURE_16BIT_PALETTE); | |
355 HIWORD(v8) = 0; | 363 HIWORD(v8) = 0; |
356 texture = pIcons_LOD->GetTexture(v7); | 364 |
357 v10 = texture->uTextureWidth; | 365 auto texture = assets->GetImage_16BitColorKey(v4->GetIconName(), 0x7FF); |
358 if ( texture->uTextureWidth < 14 ) | 366 //v7 = pIcons_LOD->LoadTexture(v4->GetIconName(), TEXTURE_16BIT_PALETTE); |
367 //texture = pIcons_LOD->GetTexture(v7); | |
368 | |
369 v10 = texture->GetWidth(); | |
370 if ( texture->GetWidth() < 14 ) | |
359 v10 = 14; | 371 v10 = 14; |
360 v12 = ((v10 - 14) >> 5) + 1; | 372 v12 = ((v10 - 14) >> 5) + 1; |
361 v11 = texture->uTextureHeight; | 373 v11 = texture->GetHeight(); |
362 if ( texture->uTextureHeight < 14 ) | 374 if ( texture->GetHeight() < 14 ) |
363 v11 = 14; | 375 v11 = 14; |
364 v13 = ((v11 - 14) >> 5) + 1; | 376 v13 = ((v11 - 14) >> 5) + 1; |
365 if ( !areWeLoadingTexture ) | 377 if ( !areWeLoadingTexture ) |
366 { | 378 { |
367 texture->Release(); | 379 texture->Release(); |