Mercurial > mm7
diff mm7_5.cpp @ 899:393a83dcc359
Paperdoll equipment error fixed
author | Ritor1 |
---|---|
date | Thu, 18 Apr 2013 11:15:54 +0600 |
parents | 10fa7dad1391 |
children | f3ccfc765502 |
line wrap: on
line diff
--- a/mm7_5.cpp Mon Apr 15 16:36:56 2013 +0600 +++ b/mm7_5.cpp Thu Apr 18 11:15:54 2013 +0600 @@ -5989,7 +5989,7 @@ } //----- (0043C91D) -------------------------------------------------------- -int __fastcall _43C91D_FormItemTextureFilename(char *a1, signed int a2, int a3, int a4) +int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder) { int result; // eax@2 char v5; // zf@3 @@ -5999,195 +5999,167 @@ signed int v9; // [sp-4h] [bp-10h]@69 result = 0; //BUG fn is void - if ( a2 <= 500 ) + if ( item_id <= 500 ) { //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0; - v5 = byte_5111C0[(a2 - 100) + 32 + 2] == 0; -LABEL_21: + v5 = party_has_equipment[(item_id - 100) + 32 + 2] == 0; + switch ( item_id ) + { + case 516: + v5 = byte_5111F6[2] == 0; + break; + case 505: + v5 = byte_5111F6[1] == 0; + break; + case 504: + v5 = byte_5111F6[0] == 0; + break; + case 533: + v5 = byte_5111F6[16] == 0; + break; + case 512: + v5 = byte_5111F6[3] == 0; + break; + case 521: + v5 = byte_5111F6[4] == 0; + break; + case 522: + v5 = byte_5111F6[5] == 0; + break; + case 523: + v5 = byte_5111F6[6] == 0; + break; + case 532: + v5 = byte_5111F6[7] == 0; + break; + case 544: + v5 = byte_5111F6[8] == 0; + break; + case 524: + v5 = byte_5111F6[9] == 0; + break; + case 535: + v5 = byte_5111F6[10] == 0; + break; + case 525: + v5 = byte_5111F6[11] == 0; + break; + case 530: + v5 = byte_5111F6[12] == 0; + break; + case 547: + v5 = byte_5111F6[13] == 0; + break; + case 548: + v5 = byte_5111F6[14] == 0; + break; + case 550: + v5 = byte_5111F6[15] == 0; + break; + default: + break; + } if ( v5 ) return result; result = 516; - if ( a2 < 66 || a2 > 78 ) - { - if ( a2 == 516 ) - goto LABEL_79; - if ( a2 != 504 && a2 != 505 && a2 != 533 ) - { - if ( (a2 < 100 || a2 > 104) && a2 != 524 && a2 != 535 ) - { - if ( a2 >= 115 && a2 <= 119 || a2 == 512 ) - { - if ( a2 == 512 ) - a2 = 312; - goto LABEL_87; - } - if ( (a2 < 89 || a2 > 99) && a2 != 521 && a2 != 522 && a2 != 523 && a2 != 532 && a2 != 544 ) + if ( item_id < 66 || item_id > 78 ) + { + if ( item_id == 516 ) + { + if ( !shoulder ) + return sprintf(pOut, "item%3.3dv%d", 234, index); + if ( shoulder == 1 ) + return sprintf(pOut, "item%3.3dv%da1", 234, index); + if ( shoulder == 2 ) + return sprintf(pOut, "item%3.3dv%da2", 234, index); + } + if ( item_id != 504 && item_id != 505 && item_id != 533 ) + { + if ( (item_id < 100 || item_id > 104) && item_id != 524 && item_id != 535 ) + { + if ( item_id >= 115 && item_id <= 119 || item_id == 512 ) + { + if ( item_id == 512 ) + item_id = 312; + return sprintf(pOut, "item%3.3dv%d", item_id, index); + } + if ( (item_id < 89 || item_id > 99) && item_id != 521 && item_id != 522 && item_id != 523 && item_id != 532 && item_id != 544 ) { result = 525; - if ( (a2 < 105 || a2 > 109) && a2 != 525 && a2 != 530 && a2 != 547 && a2 != 548 && a2 != 550 ) + if ( (item_id < 105 || item_id > 109) && item_id != 525 && item_id != 530 && item_id != 547 && item_id != 548 && item_id != 550 ) return result; - switch ( a2 ) + switch ( item_id ) { case 525: - a2 = 325; + item_id = 325; break; case 530: - a2 = 330; + item_id = 330; break; case 547: - a2 = 347; + item_id = 347; break; case 548: - a2 = 348; + item_id = 348; break; case 550: - a2 = 350; + item_id = 350; break; } - v8 = a3; - v7 = a2; - if ( !a4 ) - goto LABEL_88; -LABEL_91: - v6 = "item%3.3dv%da1"; - return sprintf(a1, v6, v7, v8); - } - if ( a2 == 521 ) - { - a2 = 239; - goto LABEL_87; - } - if ( a2 == 522 ) - { - a2 = 240; - goto LABEL_87; - } - if ( a2 == 523 ) - { - a2 = 241; - goto LABEL_87; - } - if ( a2 != 532 ) - { - if ( a2 == 544 ) - a2 = 344; - goto LABEL_87; - } - v9 = 93; - goto LABEL_70; - } - if ( a2 == 524 ) - { - a2 = 324; - goto LABEL_87; - } - if ( a2 == 535 ) - { - v9 = 104; -LABEL_70: - a2 = v9; - } -LABEL_87: - v8 = a3; - v7 = a2; -LABEL_88: - v6 = "item%3.3dv%d"; - return sprintf(a1, v6, v7, v8); - } - } - if ( a2 != 516 ) - { - switch ( a2 ) + if ( !shoulder ) + return sprintf(pOut, "item%3.3dv%d", item_id, index); + return sprintf(pOut, "item%3.3dv%da1", item_id, index); + } + if ( item_id == 521 ) + return sprintf(pOut, "item%3.3dv%d", 239, index); + if ( item_id == 522 ) + return sprintf(pOut, "item%3.3dv%d", 240, index); + if ( item_id == 523 ) + return sprintf(pOut, "item%3.3dv%d", 241, index); + if ( item_id != 532 ) + { + if ( item_id == 544 ) + item_id = 344; + return sprintf(pOut, "item%3.3dv%d", item_id, index); + } + return sprintf(pOut, "item%3.3dv%d", 93, index); + } + if ( item_id == 524 ) + return sprintf(pOut, "item%3.3dv%d", 324, index); + if ( item_id == 535 ) + item_id = 104; + return sprintf(pOut, "item%3.3dv%d", item_id, index); + } + } + if ( item_id != 516 ) + { + switch ( item_id ) { case 504: - a2 = 235; + item_id = 235; break; case 505: - a2 = 236; + item_id = 236; break; case 533: - a2 = 73; + item_id = 73; break; } -LABEL_86: - if ( a4 ) - { - if ( a4 != 1 ) - { - if ( a4 != 2 ) - return result; - v8 = a3; - v7 = a2; - v6 = "item%3.3dv%da2"; - return sprintf(a1, v6, v7, v8); - } - v8 = a3; - v7 = a2; - goto LABEL_91; - } - goto LABEL_87; - } -LABEL_79: - a2 = 234; - goto LABEL_86; - } - result = a2 - 504; - switch ( a2 ) - { - case 516: - v5 = byte_5111F6[2] == 0; - goto LABEL_21; - case 505: - v5 = byte_5111F6[1] == 0; - goto LABEL_21; - case 504: - v5 = byte_5111F6[0] == 0; - goto LABEL_21; - case 533: - v5 = byte_5111F6[16] == 0; - goto LABEL_21; - case 512: - v5 = byte_5111F6[3] == 0; - goto LABEL_21; - case 521: - v5 = byte_5111F6[4] == 0; - goto LABEL_21; - case 522: - v5 = byte_5111F6[5] == 0; - goto LABEL_21; - case 523: - v5 = byte_5111F6[6] == 0; - goto LABEL_21; - case 532: - v5 = byte_5111F6[7] == 0; - goto LABEL_21; - case 544: - v5 = byte_5111F6[8] == 0; - goto LABEL_21; - case 524: - v5 = byte_5111F6[9] == 0; - goto LABEL_21; - case 535: - v5 = byte_5111F6[10] == 0; - goto LABEL_21; - case 525: - v5 = byte_5111F6[11] == 0; - goto LABEL_21; - case 530: - v5 = byte_5111F6[12] == 0; - goto LABEL_21; - case 547: - v5 = byte_5111F6[13] == 0; - goto LABEL_21; - case 548: - v5 = byte_5111F6[14] == 0; - goto LABEL_21; - case 550: - v5 = byte_5111F6[15] == 0; - goto LABEL_21; - default: - return result; - } + if ( !shoulder ) + return sprintf(pOut, "item%3.3dv%d", item_id, index); + if ( shoulder == 1 ) + return sprintf(pOut, "item%3.3dv%da1", item_id, index); + if ( shoulder == 2 ) + return sprintf(pOut, "item%3.3dv%da2", item_id, index); + } + if ( !shoulder ) + return sprintf(pOut, "item%3.3dv%d", 234, index); + if ( shoulder == 1 ) + return sprintf(pOut, "item%3.3dv%da1", 234, index); + if ( shoulder == 2 ) + return sprintf(pOut, "item%3.3dv%da2", 234, index); + } + result = item_id - 504; return result; } @@ -6278,55 +6250,28 @@ // A750D8: using guessed type __int64 qword_A750D8; //----- (0043EE15) -------------------------------------------------------- -bool __fastcall sub_43EE15_player_has_item(unsigned int uItemID, Player *pPlayer, char a3) -{ - bool result; // eax@0 - signed int v4; // edi@3 - int *v5; // esi@3 - signed int v6; // edi@7 - bool *v7; // esi@7 - +bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) +{ if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) { - v4 = 0; - v5 = pPlayer->pInventoryIndices; - while ( 1 ) - { - if ( *v5 ) - { - result = 9 * *v5; - if ( *(int *)&pPlayer->pInventoryItems[*v5-1] == uItemID ) - break; - } - ++v4; - ++v5; - if ( v4 >= 126 ) - { - v6 = 0; - v7 = (bool *)&pPlayer->pEquipment; - while ( 1 ) - { - result = *v7; - if ( *v7 ) - { - result *= 9; - if ( *(int *)&pPlayer->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] == uItemID ) - break; - } - ++v6; - ++v7; - if ( v6 >= 16 ) - { - LOBYTE(result) = 0; - return result; - } - } - break; - } - } - } - LOBYTE(result) = 1; - return result; + for ( uint i = 0; i < 126; ++i ) + { + if ( pPlayer->pInventoryIndices[i] > 0 ) + { + if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pInventoryIndices[i] - 1].uItemID == uItemID ) + return true; + } + } + for ( uint i = 0; i < 16; ++i ) + { + if ( pPlayer->pEquipment.pIndices[i] ) + { + if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) + return true; + } + } + } + return false; } //----- (0043EE77) -------------------------------------------------------- @@ -6347,7 +6292,7 @@ v5 = 604; while ( 1 ) { - result = sub_43EE15_player_has_item(v5, *pPlayers, 0); + result = Player_has_item(v5, *pPlayers, 0); if ( !result ) break; result = v6->pEquipment.uArmor; @@ -6363,7 +6308,7 @@ } goto LABEL_6; } - result = sub_43EE15_player_has_item(604u, ::pPlayers[a1], 0); + result = Player_has_item(604u, ::pPlayers[a1], 0); if ( !result || (result = v2->pEquipment.uArmor) == 0 || (result *= 9, *(int *)&v2->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v3) )