Mercurial > mm7
comparison Chest.cpp @ 702:efde64b3e147
sub_4BDAAF clean
some Chest pointer fixes
author | zipi |
---|---|
date | Mon, 18 Mar 2013 20:19:20 +0000 |
parents | d5b16a44d9b3 |
children | ef4d646d738d |
comparison
equal
deleted
inserted
replaced
701:d5b16a44d9b3 | 702:efde64b3e147 |
---|---|
685 { | 685 { |
686 do | 686 do |
687 { | 687 { |
688 *strchr(&Buf, 10) = 0; | 688 *strchr(&Buf, 10) = 0; |
689 memcpy(&v17, texture_frame_table_txt_parser(&Buf, &v16), sizeof(v17)); | 689 memcpy(&v17, texture_frame_table_txt_parser(&Buf, &v16), sizeof(v17)); |
690 if ( v17.uPropCount && *v17.pProperties[0] != 47 ) | 690 if ( v17.uPropCount && *v17.pProperties[0] != 47 ) |
691 ++Argsa; | 691 ++Argsa; |
692 } | 692 } |
693 while ( fgets(&Buf, 490, File) ); | 693 while ( fgets(&Buf, 490, File) ); |
694 v5 = Argsa; | 694 v5 = Argsa; |
695 v3 = 0; | 695 v3 = 0; |
706 fseek(v8, v3, v3); | 706 fseek(v8, v3, v3); |
707 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | 707 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) |
708 { | 708 { |
709 *strchr(&Buf, 10) = 0; | 709 *strchr(&Buf, 10) = 0; |
710 memcpy(&v17, texture_frame_table_txt_parser(&Buf, &v16), sizeof(v17)); | 710 memcpy(&v17, texture_frame_table_txt_parser(&Buf, &v16), sizeof(v17)); |
711 if ( v17.uPropCount && *v17.pProperties[0] != 47 ) | 711 if ( v17.uPropCount && *v17.pProperties[0] != 47 ) |
712 { | 712 { |
713 strcpy(v2->pChests[v2->uNumChests].pName, v17.pProperties[0]); | 713 strcpy(v2->pChests[v2->uNumChests].pName, v17.pProperties[0]); |
714 v10 = atoi(v17.pProperties[1]); | 714 v10 = atoi(v17.pProperties[1]); |
715 v11 = v17.pProperties[2]; | 715 v11 = v17.pProperties[2]; |
716 v2->pChests[v2->uNumChests].uWidth = v10; | 716 v2->pChests[v2->uNumChests].uWidth = v10; |
724 return 1; | 724 return 1; |
725 } | 725 } |
726 | 726 |
727 //----- (00420B13) -------------------------------------------------------- | 727 //----- (00420B13) -------------------------------------------------------- |
728 void __fastcall sub_420B13(int a1, int a2) | 728 void __fastcall sub_420B13(int a1, int a2) |
729 { | 729 { |
730 void *v2; // eax@1 | 730 void *v2; // eax@1 |
731 ItemGen *v3; // ebx@1 | 731 ItemGen *v3; // ebx@1 |
732 unsigned int v4; // eax@1 | 732 unsigned int v4; // eax@1 |
733 Texture *v5; // ecx@1 | 733 Texture *v5; // ecx@1 |
734 signed int v6; // eax@1 | 734 signed int v6; // eax@1 |
743 int v15; // edi@10 | 743 int v15; // edi@10 |
744 int i; // ecx@10 | 744 int i; // ecx@10 |
745 int v17; // [sp+Ch] [bp-14h]@1 | 745 int v17; // [sp+Ch] [bp-14h]@1 |
746 int v18; // [sp+10h] [bp-10h]@3 | 746 int v18; // [sp+10h] [bp-10h]@3 |
747 int v19; // [sp+14h] [bp-Ch]@1 | 747 int v19; // [sp+14h] [bp-Ch]@1 |
748 void *v20; // [sp+18h] [bp-8h]@1 | 748 int v20; // [sp+18h] [bp-8h]@1 |
749 int v21; // [sp+1Ch] [bp-4h]@5 | 749 int v21; // [sp+1Ch] [bp-4h]@5 |
750 int v22; // [sp+1Ch] [bp-4h]@8 | 750 int v22; // [sp+1Ch] [bp-4h]@8 |
751 | 751 |
752 v19 = a2; | 752 v19 = a2; |
753 v2 = pChestWindow->ptr_1C; | 753 v2 = pChestWindow->ptr_1C; |
754 v20 = v2; | 754 v20 = (int)v2; |
755 v2 = (void *)(5324 * (int)v2); | 755 v2 = (void *)(5324 * (int)v2); |
756 v3 = (ItemGen *)((char *)v2 + 36 * a1 + (int)((char *)pChests + 4)); | 756 //v3 = (ItemGen *)((char *)v2 + 36 * a1 + (int)((char *)pChests + 4)); |
757 v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)]; | 757 v3 = &pChests[v20].igChestItems[a1]; |
758 //v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)]; | |
759 v17 = pChestWidthsByType[pChests[v20].uChestBitmapID]; | |
758 v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v3->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | 760 v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v3->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
759 v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); | 761 v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); |
760 v6 = (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureWidth : 24); | 762 v6 = (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureWidth : 24); |
761 if ( v6 < 14 ) | 763 if ( v6 < 14 ) |
762 v6 = 14; | 764 v6 = 14; |
767 if ( v8 < 14 ) | 769 if ( v8 < 14 ) |
768 v8 = 14; | 770 v8 = 14; |
769 v10 = ((v8 - 14) >> 5) + 1; | 771 v10 = ((v8 - 14) >> 5) + 1; |
770 v21 = v10; | 772 v21 = v10; |
771 if ( !areWeLoadingTexture ) | 773 if ( !areWeLoadingTexture ) |
772 { | 774 { |
773 v5->Release(); | 775 v5->Release(); |
774 pIcons_LOD->_40F9C5(); | 776 pIcons_LOD->_40F9C5(); |
775 v10 = v21; | 777 v10 = v21; |
776 } | 778 } |
777 if ( v10 > 0 ) | 779 if ( v10 > 0 ) |
778 { | 780 { |
779 v11 = 0; | 781 v11 = 0; |
780 v22 = v10; | 782 v22 = v10; |
781 do | 783 do |
784 { | |
785 if ( v9 > 0 ) | |
782 { | 786 { |
783 if ( v9 > 0 ) | |
784 { | |
785 v12 = v9; | 787 v12 = v9; |
786 v13 = &pChests[0].pInventoryIndices[v19 + v11 + 2662 * (int)v20]; | 788 //v13 = &pChests[0].pInventoryIndices[v19 + v11 + 2662 * (int)v20]; |
789 v13 = &pChests[v20].pInventoryIndices[v19 + v11]; | |
787 v14 = v12 & 1; | 790 v14 = v12 & 1; |
788 v12 >>= 1; | 791 v12 >>= 1; |
789 memset(v13, 0, 4 * v12); | 792 memset(v13, 0, 4 * v12); |
790 v15 = (int)((char *)v13 + 4 * v12); | 793 v15 = (int)((char *)v13 + 4 * v12); |
791 for ( i = v14; i; --i ) | 794 for ( i = v14; i; --i ) |
792 { | 795 { |
793 *(short *)v15 = 0; | 796 *(short *)v15 = 0; |
794 v15 += 2; | 797 v15 += 2; |
795 } | 798 } |
796 v9 = v18; | 799 v9 = v18; |
797 } | 800 } |
798 v11 += v17; | 801 v11 += v17; |
799 --v22; | 802 --v22; |
800 } | 803 } |
801 while ( v22 ); | 804 while ( v22 ); |
802 } | 805 } |
803 v3->Reset(); | 806 v3->Reset(); |
804 } | 807 } |
805 // 506128: using guessed type int areWeLoadingTexture; | 808 // 506128: using guessed type int areWeLoadingTexture; |