Mercurial > mm7
changeset 411:747933903b1c
00401A91 sub_401A91_AI(): actors drop when dead
author | Nomad |
---|---|
date | Sat, 23 Feb 2013 16:00:21 +0200 |
parents | ff964014159f |
children | bbd8888534dc |
files | Actor.h AudioPlayer.cpp mm7_3.cpp |
diffstat | 3 files changed, 96 insertions(+), 90 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.h Sat Feb 23 14:42:28 2013 +0200 +++ b/Actor.h Sat Feb 23 16:00:21 2013 +0200 @@ -40,6 +40,8 @@ /* 361 */ enum ACTOR_BUFF_INDEX { + ACTOR_BUFF_CHARM = 1, // an assumption + ACTOR_BUFF_SHRINK = 3, // an assumption ACTOR_BUFF_STONED = 5, ACTOR_BUFF_PARALYZED = 6, };
--- a/AudioPlayer.cpp Sat Feb 23 14:42:28 2013 +0200 +++ b/AudioPlayer.cpp Sat Feb 23 16:00:21 2013 +0200 @@ -1642,6 +1642,7 @@ { case 0: case OBJECT_Player: + case OBJECT_BModel: continue; case OBJECT_BLVDoor:
--- a/mm7_3.cpp Sat Feb 23 14:42:28 2013 +0200 +++ b/mm7_3.cpp Sat Feb 23 16:00:21 2013 +0200 @@ -17671,7 +17671,7 @@ //----- (00401A91) -------------------------------------------------------- void __cdecl sub_401A91_AI() { - unsigned int v0; // esi@4 + //unsigned int v0; // esi@4 int v1; // eax@7 int v2; // ecx@7 int v3; // eax@7 @@ -17681,16 +17681,16 @@ __int16 v7; // cx@14 Player **v8; // esi@20 Player *pPlayer; // ecx@21 - Actor *pActor; // esi@34 - __int16 v11; // ax@34 - unsigned int v12; // eax@47 - signed int v13; // edi@47 - SpellBuff *v14; // ebx@47 - unsigned int v15; // edi@67 - char *v16; // eax@67 - unsigned int v17; // edx@67 - unsigned int v18; // ecx@67 - unsigned __int16 v19; // ax@72 + //Actor *pActor; // esi@34 + //__int16 v11; // ax@34 + //unsigned int v12; // eax@47 + //signed int v13; // edi@47 + //SpellBuff *v14; // ebx@47 + //unsigned int v15; // edi@67 + //char *v16; // eax@67 + //unsigned int v17; // edx@67 + //unsigned int v18; // ecx@67 + //unsigned __int16 v19; // ax@72 int *v20; // esi@80 Actor *v21; // ebx@80 unsigned __int16 v22; // ax@86 @@ -17763,7 +17763,7 @@ else MakeActorAIList_BLV(); - v0 = 0; + //v0 = 0; if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) { if ( pParty->armageddon_timer > 417 ) @@ -17824,9 +17824,9 @@ ++v8; } while ( (signed int)v8 <= (signed int)&pPlayers[4] ); - v0 = 0; - } - if ( pTurnEngine->field_1C != v0 ) + //v0 = 0; + } + if (pTurnEngine->field_1C) --pTurnEngine->field_1C; } } @@ -17838,26 +17838,34 @@ } - uActorID = v0; - if ( (signed int)uNumActors > (signed int)v0 ) - { - LODWORD(v80) = (int)(char *)pActors + 176; - do - { - pActor = (Actor *)(LODWORD(v80) - 176); - v11 = *(unsigned int *)LODWORD(v80); - v49 = *(unsigned int *)LODWORD(v80) == 5; - dword_4F6E08[uActorID] = 4; - if ( v49 || v11 == 11 || v11 == 19 || *(char *)(LODWORD(v80) - 139) & 4 ) - goto LABEL_78; - if ( !*(short *)(LODWORD(v80) - 136) && v11 != 4 ) - Actor::Die(uActorID); - v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; - v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; - v12 = 0; - v13 = 0; - v14 = (SpellBuff *)(LODWORD(v80) + 36); - do + //uActorID = v0; + for (uint i = 0; i < uNumActors; ++i) + { + auto actor = pActors + i; + //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState + //do + //{ + //pActor = (Actor *)(LODWORD(v80) - 176); + //v11 = *(unsigned int *)LODWORD(v80); + //v49 = *(unsigned int *)LODWORD(v80) == 5; + dword_4F6E08[i] = 4; + if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400) + continue; + + if (!actor->sCurrentHP && actor->uAIState != Dying) + Actor::Die(i); + + //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; + //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; + //v12 = 0; + //v13 = 0; + //v14 = (SpellBuff *)(LODWORD(v80) + 36); + for (uint j = 0; j < 22; ++j) + { + if (j != 10) + actor->pActorBuffs[j]._4585CA(pParty->uTimePlayed); + } + /*do { if ( v13 != 10 ) { @@ -17867,61 +17875,56 @@ ++v13; ++v14; } - while ( v13 < 22 ); - if ( v84 != v12 - && SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 - && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 - || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) - pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; - if ( v82 != v12 ) - { - pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; - if ( SHIDWORD(pActor->pActorBuffs[1].uExpireTime) <= (signed int)v12 ) - { - if ( SHIDWORD(pActor->pActorBuffs[1].uExpireTime) < (signed int)v12 - || LODWORD(pActor->pActorBuffs[1].uExpireTime) <= v12 ) - pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; - } - } - if ( SHIDWORD(pActor->pActorBuffs[5].uExpireTime) > (signed int)v12 - || SHIDWORD(pActor->pActorBuffs[5].uExpireTime) >= (signed int)v12 - && LODWORD(pActor->pActorBuffs[5].uExpireTime) - || SHIDWORD(pActor->pActorBuffs[6].uExpireTime) > 0 - || SHIDWORD(pActor->pActorBuffs[6].uExpireTime) >= 0 && LODWORD(pActor->pActorBuffs[6].uExpireTime) ) - goto LABEL_78; - v15 = pMiscTimer->uTimeElapsed; - v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; - pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; - v17 = pActor->uCurrentActionTime; - v18 = pActor->pMonsterInfo.uRecoveryTime; - if ( (signed int)v18 > 0 ) - *(int *)v16 = v18 - v15; - if ( *(int *)v16 < 0 ) - *(int *)v16 = 0; - if ( (signed int)v17 < pActor->uCurrentActionLength ) - goto LABEL_78; - v19 = pActor->uAIState; - if ( v19 == Dying ) - { - pActor->uAIState = Dead; - } - else - { - if ( v19 != 17 ) - { - Actor::_403F58(uActorID, Dying, 256, 0); - goto LABEL_78; - } - pActor->uAIState = Standing; - } - pActor->uCurrentActionTime = 0; - pActor->uCurrentActionLength = 0; - pActor->UpdateAnimation(); -LABEL_78: - ++uActorID; - LODWORD(v80) += 836; - } - while ( (signed int)uActorID < (signed int)uNumActors ); + while ( v13 < 22 );*/ + if (!actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) + //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 + // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) + actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; + if (actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime) + actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + else + actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; + + if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime || + actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) + continue; + + //v15 = pMiscTimer->uTimeElapsed; + //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; + //v17 = pActor->uCurrentActionTime; + //v18 = pActor->pMonsterInfo.uRecoveryTime; + if (actor->pMonsterInfo.uRecoveryTime) + { + if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) + actor->pMonsterInfo.uRecoveryTime = 0; + else actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; + } + + actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; + if (actor->uCurrentActionTime < actor->uCurrentActionLength) + continue; + + //v19 = actor->uAIState; + if (actor->uAIState == Dying) + actor->uAIState = Dead; + else + { + if (actor->uAIState != Summoned) + { + Actor::_403F58(i, Dying, 256, 0); + continue; + } + actor->uAIState = Standing; + } + + actor->uCurrentActionTime = 0; + actor->uCurrentActionLength = 0; + actor->UpdateAnimation(); +//LABEL_78: + //++uActorID; + //LODWORD(v80) += 836; + //} + //while ( (signed int)uActorID < (signed int)uNumActors ); }