Mercurial > might-and-magic-trilogy
diff mm7_5.cpp @ 131:d2ca891da89f
Слияние
author | Ritor1 |
---|---|
date | Wed, 07 Nov 2012 22:10:04 +0600 |
parents | 8be5293b6b33 |
children | 918dca162239 |
line wrap: on
line diff
--- a/mm7_5.cpp Wed Nov 07 22:09:43 2012 +0600 +++ b/mm7_5.cpp Wed Nov 07 22:10:04 2012 +0600 @@ -2229,7 +2229,7 @@ v66 = stru_4ECBB8[uMessageParam].rot_x; _5B65B4_npcdata_loword_house_or_other = stru_4ECBB8[uMessageParam].rot_y; _5B65B8_npcdata_hiword_house_or_other = v66; - UpdateActors(); + InitializeActors(); } v67 = pGUIWindow_CurrentMenu->Hint; if ( v67 ) @@ -11721,18 +11721,13 @@ //----- (00408768) -------------------------------------------------------- -char __cdecl UpdateActors() -{ - unsigned int v0; // edi@1 - __int16 v1; // ax@7 - char *v2; // esi@10 - char v3; // zf@13 +void InitializeActors() +{ signed int v5; // [sp+Ch] [bp-10h]@1 signed int v6; // [sp+10h] [bp-Ch]@1 signed int v7; // [sp+14h] [bp-8h]@1 signed int v8; // [sp+18h] [bp-4h]@1 - v0 = 0; v8 = 0; v6 = 0; v7 = 0; @@ -11741,65 +11736,48 @@ v8 = 1; if ( !_strcmpi(pCurrentMapName, "d26.blv") ) v6 = 1; - if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 99) ) + if (_449B57_test_bit(pParty->_award_bits, 99)) v7 = 1; - v1 = _449B57_test_bit(pParty->_award_bits, 100); - if ( v1 ) + if (_449B57_test_bit(pParty->_award_bits, 100)) v5 = 1; - if ( (signed int)uNumActors > 0 ) - { - v2 = (char *)&pActors[0].vPosition; - do - { - if ( ((Actor *)(v2 - 142))->CanAct() || *((short *)v2 + 17) == 19 ) - { - v3 = *((short *)v2 + 17) == 19; - *(short *)v2 = *((short *)v2 + 10); - *((short *)v2 + 1) = *((short *)v2 + 11); - *((short *)v2 + 2) = *((short *)v2 + 12); - *((short *)v2 - 51) = *((short *)v2 - 17); - if ( !v3 ) - Actor::_403EB6(v0, dword_4F6E08[v0], *(int *)(v2 - 18), 0); - } - *(v2 - 81) = 0; - LOBYTE(v1) = 0; - if ( !v8 || v7 ) - { - if ( !v6 || v5 ) - { - LOBYTE(v1) = ((Actor *)(v2 - 142))->_438B9B(); - if ( (char)v1 ) - *(v2 - 104) &= 0xF7u; - } - } - *(v2 - 104) &= 0x7Fu; - if ( *(v2 - 104) & 0x40 ) - LOBYTE(v1) = Actor::_4031C1_update_job(v0, pParty->uCurrentHour, 1); - ++v0; - v2 += 836; - } - while ( (signed int)v0 < (signed int)uNumActors ); - } - return v1; + for (uint i = 0; i < uNumActors; ++i) + { + auto actor = pActors + i; + + if (actor->CanAct() || actor->uAIState == Disabled) + { + actor->vPosition.x = actor->vInitialPosition.x; + actor->vPosition.y = actor->vInitialPosition.y; + actor->vPosition.z = actor->vInitialPosition.z; + actor->sCurrentHP = actor->pMonsterInfo.uHP; + if (actor->uAIState != Disabled) + Actor::_403EB6(i, dword_4F6E08[i], actor->pMonsterInfo.uRecoveryTime, 0); + } + + actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + + if (!v8 || v7) + if (!v6 || v5) + if (actor->_438B9B()) + BYTE2(actor->uAttributes) &= 0xF7u; + + BYTE2(actor->uAttributes) &= 0x7Fu; + if (BYTE2(actor->uAttributes) & 0x40) + Actor::_4031C1_update_job(i, pParty->uCurrentHour, 1); + } } //----- (00408896) -------------------------------------------------------- -void UpdateLayingItems() -{ - unsigned int v0; // edi@1 - char *v1; // esi@1 - char *result; // eax@7 - - v0 = 0; - v1 = (char *)&pLayingItems[0].uObjectDescID; - do - { - if ( *(short *)v1 && (v1[24] & 8 || pObjectList->pObjects[*(short *)v1].uFlags & 0x10) ) - LayingItem::_42F933(v0); - v1 += 112; - ++v0; - } - while ( (signed int)v1 < (signed int)((char *)&pObjectList->uNumObjects + 2) ); +void InitializeLayingItems() +{ + for (uint i = 0; i < uNumLayingItems; ++i) + { + auto item = pLayingItems + i; + + if (item->uItemType && + (item->uSoundID & 8 || pObjectList->pObjects[item->uItemType].uFlags & 0x10)) + LayingItem::_42F933(i); + } for (uint i = 0; i < 100; ++i) array_5118E8.pElements[i].field_C_time_left = 0;