Mercurial > mm7
diff mm7_6.cpp @ 89:98cd93e14777
pointer fixes
author | zipi |
---|---|
date | Wed, 06 Feb 2013 21:19:42 +0000 |
parents | 1faa29fd4c2d |
children | d61f6bc04bf2 |
line wrap: on
line diff
--- a/mm7_6.cpp Mon Feb 04 17:21:02 2013 +0600 +++ b/mm7_6.cpp Wed Feb 06 21:19:42 2013 +0000 @@ -1294,7 +1294,9 @@ //----- (004269A2) -------------------------------------------------------- int __fastcall sub_4269A2_GivePartyExp(unsigned int a1) { - unsigned __int64 v1; // qax@1 + //unsigned __int64 v1; // qax@1 + Player *v1; + int v1b; signed int v2; // ecx@1 int *v3; // esi@1 bool v4; // edi@6 @@ -1302,30 +1304,37 @@ Player *v6; // esi@10 int v7; // eax@13 unsigned __int8 v8; // cf@13 - int v10; // [sp+Ch] [bp-14h]@1 + int v10[4]; // [sp+Ch] [bp-14h]@1 int v11; // [sp+1Ch] [bp-4h]@10 - v1 = __PAIR__((int)((char *)&pParty + 2620), a1); + //v1 = __PAIR__((int)((char *)&pParty + 2620), a1); + v1 = pParty->pPlayers; + v1b = a1; v2 = 0; - v3 = &v10; + v3 = v10; do { - v4 = !(*(int *)(HIDWORD(v1) - 4) | *(int *)(HIDWORD(v1) - 8)) + /*v4 = !(*(int *)(HIDWORD(v1) - 4) | *(int *)(HIDWORD(v1) - 8)) && !*(int *)HIDWORD(v1) && !*(_QWORD *)(HIDWORD(v1) + 8) - && !*(_QWORD *)(HIDWORD(v1) + 16); + && !*(_QWORD *)(HIDWORD(v1) + 16);*/ + v4 = !(HIDWORD(v1->pConditions[13]) | LODWORD(v1->pConditions[13])) + && !v1->pConditions[14] + && !v1->pConditions[15] + && !v1->pConditions[16]; *v3 = v4; - HIDWORD(v1) += 6972; + //HIDWORD(v1) += 6972; + ++v1; v2 += v4; ++v3; } - while ( SHIDWORD(v1) < (signed int)&pParty->pHirelings[1].field_24 ); + while ( v1 <= &pParty->pPlayers[3] ); if ( v2 ) { - LODWORD(v1) = (signed int)v1 / v2; - v5 = &v10; + v1b = v1b / v2; + v5 = v10; v6 = pParty->pPlayers;//[0].uExperience; - v11 = v1; + v11 = v1b; do { if ( *v5 ) @@ -1333,10 +1342,11 @@ if ( v11 ) { LOBYTE(v7) = v6->GetLearningPercent(); - v1 = v11 + v11 * v7 / 100; - v8 = __CFADD__((int)v1, LODWORD(v6->uExperience)); - LODWORD(v6->uExperience) += v1; - HIDWORD(v6->uExperience) += HIDWORD(v1) + v8; + v1b = v11 + v11 * v7 / 100; + //v8 = __CFADD__((int)v1, LODWORD(v6->uExperience)); + //need review + LODWORD(v6->uExperience) += v1b; + //HIDWORD(v6->uExperience) += HIDWORD(v1) + v8; if ( v6->uExperience > 4000000000i64 ) { HIDWORD(v6->uExperience) = 0; @@ -1349,7 +1359,7 @@ } while ( v6 <= &pParty->pPlayers[3] ); } - return v1; + return v1b; } //----- (00426A5A) -------------------------------------------------------- @@ -1720,9 +1730,9 @@ unsigned __int8 v3; // cf@11 unsigned __int8 v4; // zf@11 SpellBuff *v6; // ecx@46 - char *v7; // esi@49 + Player *v7; // esi@49 signed int v8; // edx@50 - char *v9; // ecx@50 + SpellBuff *v9; // ecx@50 if ( a2 > 73 ) { @@ -1738,22 +1748,25 @@ while ( (signed __int64)v6->uExpireTime <= 0 ) { ++v6; - if ( (signed int)v6 >= (signed int)pParty->pPlayers ) - { - v7 = (char *)pParty->pPlayers[0].pPlayerBuffs; -LABEL_50: + if ( v6 > &pParty->pPartyBuffs[19] ) + { + v7 = pParty->pPlayers;//[0].pPlayerBuffs; v8 = 0; - v9 = v7; - while ( *(_QWORD *)v9 <= 0i64 ) + v9 = v7->pPlayerBuffs; + while ( v9->uExpireTime <= 0i64 ) { ++v8; - v9 += 16; + ++v9; if ( v8 >= 24 ) { - v7 += 6972; - if ( (signed int)v7 < (signed int)&pParty->field_871C[464] ) - goto LABEL_50; - return 0; + ++v7; + if ( v7 <= &pParty->pPlayers[3] ) + { + v8 = 0; + v9 = v7->pPlayerBuffs; + } + else + return 0; } } return 1; @@ -1802,9 +1815,8 @@ return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; - goto LABEL_15; } - if ( a2 == 5 ) + else if ( a2 == 5 ) { if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) return 1; @@ -1812,9 +1824,8 @@ return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; - goto LABEL_15; } - if ( a2 == 17 ) + else if ( a2 == 17 ) { if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) return 1; @@ -1822,9 +1833,8 @@ return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; - goto LABEL_15; } - if ( a2 == 38 ) + else if ( a2 == 38 ) { if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) return 1; @@ -1832,9 +1842,8 @@ return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; - goto LABEL_15; } - if ( a2 == 46 ) + else if ( a2 == 46 ) { if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) return 1; @@ -1842,28 +1851,32 @@ return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; - goto LABEL_15; } - if ( a2 != 47 ) - { - if ( a2 != 51 || SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) - return 1; - if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) - { - v3 = 0; - v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; - goto LABEL_15; - } - return 0; - } - if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) - return 1; - if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) - return 0; - v3 = 0; - v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; + else + { + if ( a2 != 47 ) + { + if ( a2 != 51 || SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) + return 1; + if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) + { + v3 = 0; + v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; + } + else + return 0; + } + else + { + if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) + return 1; + if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) + return 0; + v3 = 0; + v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; + } + } } -LABEL_15: if ( !(v3 | v4) ) return 0; return 1; @@ -2601,7 +2614,7 @@ const char *v66; // ecx@200 unsigned int v67; // edx@201 char v68; // al@207 - int v69; // esi@211 + ItemGen *v69; // esi@211 int v70; // ecx@214 int v71; // ecx@215 int v72; // ecx@216 @@ -2624,7 +2637,7 @@ stru6 *v89; // eax@245 double v90; // st7@245 int v91; // eax@250 - char *v92; // eax@255 + Player *v92; // eax@255 __int16 v93; // ST18_2@260 stru6 *v94; // eax@260 __int16 v95; // ST18_2@260 @@ -3085,7 +3098,7 @@ unsigned __int16 v550; // di@991 int v551; // ecx@993 int v552; // ecx@994 - char *v553; // edi@1001 + Player *v553; // edi@1001 __int16 v554; // ST18_2@1002 stru6 *v555; // eax@1002 __int16 v556; // ST18_2@1002 @@ -3144,8 +3157,8 @@ signed int v609; // eax@1104 int v610; // edi@1106 unsigned int v611; // eax@1106 - char *v612; // edi@1106 - char *v613; // eax@1108 + Player *v612; // edi@1106 + DDM_DLV_Header *v613; // eax@1108 int v614; // eax@1116 int v615; // edi@1119 __int16 v616; // ST1C_2@1122 @@ -3263,6 +3276,8 @@ unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 Player *pPlayer; // [sp+E64h] [bp-20h]@8 int v730; // [sp+E68h] [bp-1Ch]@53 + Player *v730b; + ItemGen *v730c; int v731; // [sp+E6Ch] [bp-18h]@48 signed int v732; // [sp+E70h] [bp-14h]@325 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 @@ -3985,23 +4000,23 @@ LABEL_196: if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; - v730 = (int)&pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; - v726 = (Player *)&pItemsTable->pItems[*(int *)v730].pIconName; - ((ItemGen *)v730)->UpdateTempBonus(pParty->uTimePlayed); - if ( *(int *)v730 < 64 || *(int *)v730 > 65 ) - { - if ( !(*(char *)(v730 + 20) & 2) ) + v730c = &pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; + v726 = (Player *)&pItemsTable->pItems[v730c->uItemID].pIconName; + v730c->UpdateTempBonus(pParty->uTimePlayed); + if ( v730c->uItemID < 64 || v730c->uItemID > 65 ) + { + if ( !(v730c->uAttributes & 2) ) { - if ( *(int *)(v730 + 12) == v1 ) + if ( v730c->uAdditionalValue == v1 ) { - if ( *(int *)(v730 + 4) == v1 ) + if ( v730c->_bonus_type == v1 ) { v68 = BYTE4(v726->pConditions[3]); if ( !v68 || v68 == 1 || v68 == 2 ) { - if ( !pItemsTable->_456D5E_is_some_material((ItemGen *)v730) ) + if ( !pItemsTable->_456D5E_is_some_material(v730c) ) { - v69 = v730; + v69 = v730c; v14 = v731 == 4; *(int *)(v730 + 12) = amount; if ( !v14 ) @@ -4212,15 +4227,15 @@ LABEL_254: if ( pPlayer->CanCastSpell(uRequiredMana) ) { - v92 = (char *)&pParty->pPlayers[0].pConditions[1]; + v92 = pParty->pPlayers;//[0].pConditions[1]; LODWORD(v727) = 1; do { - if ( *(_QWORD *)v92 ) + if ( v92->pConditions ) LODWORD(v727) = v1; - v92 += 6972; + ++v92; } - while ( (signed int)v92 < (signed int)&pParty->pHirelings[0].uFlags ); + while ( v92 <= &pParty->pPlayers[3] ); if ( LODWORD(v727) != v1 ) { v726 = (Player *)((int)v733 << 7); @@ -4290,18 +4305,18 @@ v105 = 0; v726 = (Player *)((int)v733 << 7); v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); - v730 = (int)&pParty->pPlayers[0].pPlayerBuffs[1]; + v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; do { v106 = v3->spellnum; v107 = pGame->GetStru6(); pGame->GetStru6()->SetPlayerBuffAnim(v106, v105); v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, v1, 65536); - ((SpellBuff *)v730)->Apply(pParty->uTimePlayed + v717, v731, amount, v716, v1); - v730 += 6972; + v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, v1); + ++v730b; ++v105; } - while ( v730 < (signed int)&pParty->field_871C[468] ); + while ( v730b <= &pParty->pPlayers[3] ); goto LABEL_1056; case 52: if ( pPlayer->CanCastSpell(uRequiredMana) && a2 != v1 && (a2 & 7) == 3 ) @@ -5148,7 +5163,8 @@ v239); if ( v731 == 4 ) pParty->pPartyBuffs[18].uFlags = 1; - goto LABEL_1112; + LODWORD(v727) = v232; + goto LABEL_83; case 28: if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; @@ -7104,7 +7120,7 @@ v732 = (300 * amount * v2 + 60) << 7; v730 = v2 + 5; v726 = (Player *)v1; - v553 = (char *)&pParty->pPlayers[0].pConditions[1]; + v553 = pParty->pPlayers;//[0].pConditions[1]; *((float *)&v733 + 1) = (double)v732 * 0.033333335; do { @@ -7120,7 +7136,8 @@ v560 = v3->spellnum; v561 = pGame->GetStru6(); pGame->GetStru6()->SetPlayerBuffAnim(v560, 3u); - ((SpellBuff *)(v553 + 6056))->Apply( + //((SpellBuff *)(v553 + 6056))->Apply( + v553->pPlayerBuffs[4].Apply( (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, @@ -7128,9 +7145,9 @@ v1); if ( *(_QWORD *)v553 ) v726 = (Player *)1; - v553 += 6972; - } - while ( (signed int)v553 < (signed int)&pParty->pHirelings[0].uFlags ); + ++v553; + } + while ( v553 <= &pParty->pPlayers[3] ); v562 = v731; pParty->pPartyBuffs[9].Apply( (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), @@ -7514,21 +7531,20 @@ v611); v232 = 1; *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; - v612 = (char *)pParty->pPlayers; + v612 = pParty->pPlayers; do { - *((int *)v612 + 1615) = ((Player *)v612)->GetMaxHealth(); - *((int *)v612 + 1616) = ((Player *)v612)->GetMaxMana(); - v612 += 6972; - } - while ( (signed int)v612 < (signed int)pParty->pHirelings ); - v613 = (char *)&pOutdoor->ddm; + v612->sHealth = v612->GetMaxHealth(); + v612->sMana = v612->GetMaxMana(); + ++v612; + } + while ( v612 <= &pParty->pPlayers[3] ); + v613 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) - v613 = (char *)&pIndoor->dlv; - *((int *)v613 + 2) += 15; - if ( *((int *)v613 + 2) > 10000 ) - *((int *)v613 + 2) = 10000; -LABEL_1112: + v613 = &pIndoor->dlv; + v613->uReputation += 15; + if ( v613->uReputation > 10000 ) + v613->uReputation = 10000; LODWORD(v727) = v232; goto LABEL_83; case 95: