Mercurial > mm7
changeset 1902:39b6d789cbfc
Слияние
author | Ritor1 |
---|---|
date | Mon, 21 Oct 2013 10:07:32 +0600 |
parents | 781522bf1a07 (current diff) cbeb25a148ad (diff) |
children | 79ac2dbedfb9 |
files | mm7_2.cpp |
diffstat | 8 files changed, 544 insertions(+), 849 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Oct 21 10:07:23 2013 +0600 +++ b/Actor.cpp Mon Oct 21 10:07:32 2013 +0600 @@ -342,9 +342,9 @@ else if (masteryLevel == 4) v23 = 14; spellnumb = 0; + v28 = 0; for ( int i = 0; i < v23; i++) { - v28 = spellnumb; v30 = rand() % 1000; spellnumc = v30 - 2500; v120 = v28 * v28; @@ -396,6 +396,7 @@ pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[9], PID(OBJECT_Item, v36), 0, -1, 0, 0, 0, 0); } spellnumb = rand() % 1024 - 512; + v28 = rand() % 1024 - 512; } return; break; @@ -1219,34 +1220,18 @@ void Actor::AI_MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0) { Actor *v3; // ebx@1 - char v4; // zf@1 - //unsigned int result; // eax@3 - AIDirection *v6; // esi@6 - AIDirection *v7; // edi@6 + int16_t v6; // esi@6 + int16_t v7; // edi@6 signed int v8; // eax@7 - double v9; // st7@9 Vec3_int_ v10; // ST04_12@9 - //int v11; // eax@10 AIDirection *v12; // eax@11 - unsigned int v13; // esi@11 - AIDirection *v14; // esi@12 - SpriteFrame *v15; // ecx@13 - __int16 v16; // ax@13 - unsigned int v17; // ecx@13 - signed __int64 v18; // qax@13 AIDirection a3; // [sp+Ch] [bp-48h]@12 AIDirection v20; // [sp+28h] [bp-2Ch]@12 - unsigned int v21; // [sp+44h] [bp-10h]@9 - //signed int a2; // [sp+48h] [bp-Ch]@1 int v23; // [sp+4Ch] [bp-8h]@6 - unsigned int v24; // [sp+50h] [bp-4h]@1 unsigned int v25; // [sp+5Ch] [bp+8h]@13 v3 = &pActors[uActorID]; - //a2 = edx0; - v4 = v3->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY; - v24 = uActorID; - if ( v4 && v3->pMonsterInfo.uAIType == 1 ) + if ( v3->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY && v3->pMonsterInfo.uAIType == 1 ) { Actor::AI_Stand(uActorID, sTargetPid, 0, arg0); return; @@ -1254,237 +1239,153 @@ if ( PID_TYPE(sTargetPid) == OBJECT_Actor) { - v8 = PID_ID(sTargetPid); - v6 = (AIDirection *)pActors[v8].vPosition.x; - v7 = (AIDirection *)pActors[v8].vPosition.y; - v23 = (signed __int64)((double)pActors[v8].uActorHeight * 0.75 + (double)pActors[v8].vPosition.z); + v8 = PID_ID(sTargetPid); + v6 = pActors[v8].vPosition.x; + v7 = pActors[v8].vPosition.y; + v23 = (int)(pActors[v8].uActorHeight * 0.75 + pActors[v8].vPosition.z); } else if ( PID_TYPE(sTargetPid) == OBJECT_Player) { - v6 = (AIDirection *)pParty->vPosition.x; - v7 = (AIDirection *)pParty->vPosition.y; + v6 = pParty->vPosition.x; + v7 = pParty->vPosition.y; v23 = pParty->vPosition.z + pParty->sEyelevel; } else { - v6 = arg0; - v7 = arg0; + Error("Should not get here"); + return; } - v21 = v3->uActorHeight; - v9 = (double)(signed int)v21 * 0.75; - v21 = v3->vPosition.z; - v10.z = (signed __int64)(v9 + (double)(signed int)v21); + v10.z = (int32_t)(v3->uActorHeight * 0.75 + v3->vPosition.z); v10.y = v3->vPosition.y; v10.x = v3->vPosition.x; + if ( sub_407A1C((int)v6, (int)v7, v23, v10) ) { - v12 = arg0; - v13 = 0; - if ( !arg0 ) + if (arg0 != nullptr) { - v14 = Actor::GetDirectionInfo(PID(OBJECT_Actor, v24), sTargetPid, &a3, 0); - v12 = &v20; - memcpy(&v20, v14, sizeof(v20)); - v13 = 0; + v12 = arg0; } - v15 = pSpriteFrameTable->pSpriteSFrames; + else + { + v12 = Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), sTargetPid, &a3, 0); + } v3->uYawAngle = LOWORD(v12->uYawAngle); - v16 = v15[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength; - v17 = v24; - v3->uCurrentActionLength = 8 * v16; - v3->uCurrentActionTime = v13; + v3->uCurrentActionLength = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength * 8; + v3->uCurrentActionTime = 0; v3->uAIState = AttackingMelee; - Actor::PlaySound(v17, 0); - LODWORD(v18) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; + Actor::PlaySound(uActorID, 0); v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v13 - && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v13 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v13) ) + if ( v3->pActorBuffs[7].uExpireTime > 0 ) { - LODWORD(v18) = 2 * v18; - v25 = v18; + v25 *= 2; } if ( pParty->bTurnBasedModeOn != 1 ) - v18 = (signed __int64)(flt_6BE3A8_debug_recmod2 * (double)(signed int)v25 * 2.133333333333333); - v3->pMonsterInfo.uRecoveryTime = v18; - v3->vVelocity.z = v13; - v3->vVelocity.y = v13; - v3->vVelocity.x = v13; + { + v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * v25 * 2.133333333333333); + } + else + { + v3->pMonsterInfo.uRecoveryTime = v25; + } + v3->vVelocity.z = 0; + v3->vVelocity.y = 0; + v3->vVelocity.x = 0; v3->UpdateAnimation(); } else - Actor::AI_Pursue1(v24, sTargetPid, rand() % 2, 64, arg0); + Actor::AI_Pursue1(uActorID, sTargetPid, rand() % 2, 64, arg0); } //----- (00438CF3) -------------------------------------------------------- void Actor::ApplyFineForKillingPeasant(unsigned int uActorID) { - unsigned int v1; // esi@1 - unsigned int v2; // edi@2 - char v3; // bl@3 - //char *v4; // ecx@16 - //signed int v5; // eax@18 - Player **ppPlayers; // esi@20 + if ( uLevelMapStatsID == 0 || !pActors[uActorID].IsPeasant()) + return; - v1 = uLevelMapStatsID; - if ( !uLevelMapStatsID || !pActors[uActorID].IsPeasant()) + if ( (uLevelMapStatsID == 6 || uLevelMapStatsID == 7) && pParty->IsPartyEvil()) //celeste and bracada + return; + + if ( (uLevelMapStatsID == 5 || uLevelMapStatsID == 8) && pParty->IsPartyGood()) // the pit and deyja return; - v2 = uActorID; - v3 = 1; - if ( v1 != 5 ) + pParty->uFine += 100 * (pMapStats->pInfos[uLevelMapStatsID]._steal_perm + pActors[uActorID].pMonsterInfo.uLevel + pParty->GetPartyReputation()); + if ( pParty->uFine < 0 ) + pParty->uFine = 0; + if ( pParty->uFine > 4000000 ) + pParty->uFine = 4000000; + + if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) { - if ( v1 == 6 || v1 == 7 ) - { - pParty->IsPartyGood(); //the binary file contains this call. if someone finds out whether it's supposed to be here or not, feel free to apply the appropriate change - if ( pParty->IsPartyEvil() ) - return; - goto LABEL_12; - } - if ( v1 != 8 ) - goto LABEL_12; + if (pOutdoor->ddm.uReputation < 10000) + pOutdoor->ddm.uReputation++; } - if ( pParty->IsPartyGood() ) - v3 = 0; - if ( pParty->IsPartyEvil() ) - v3 = 1; - if ( v3 ) + else if (uCurrentlyLoadedLevelType == LEVEL_Indoor) { -LABEL_12: - pParty->uFine += 100 * (pMapStats->pInfos[uLevelMapStatsID]._steal_perm + pActors[v2].pMonsterInfo.uLevel + pParty->GetPartyReputation()); - if ( pParty->uFine < 0 ) - pParty->uFine = 0; - if ( pParty->uFine > 4000000 ) - pParty->uFine = 4000000; + if (pIndoor->dlv.uReputation < 10000) + pIndoor->dlv.uReputation++; + } + else assert(false); - if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - { - if (pOutdoor->ddm.uReputation < 10000) - pOutdoor->ddm.uReputation++; - } - else if (uCurrentlyLoadedLevelType == LEVEL_Indoor) + if ( pParty->uFine ) + { + for ( int i = 1; i <= 4; i++) { - if (pIndoor->dlv.uReputation < 10000) - pIndoor->dlv.uReputation++; + if ( !_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1) ) + _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1u); } - else assert(false); - - ppPlayers = &pPlayers[1]; - do - { - if ( pParty->uFine ) - { - if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->_achieved_awards_bits, 1) ) - _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->_achieved_awards_bits, 1, 1u); - } - ++ppPlayers; - } - while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] ); } } //----- (0043AE80) -------------------------------------------------------- void Actor::AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3) { - int result; // eax@1 unsigned int v4; // esi@1 - int v5; // [sp-14h] [bp-18h]@3 - unsigned int v6; // [sp-10h] [bp-14h]@3 - int v7; // [sp-Ch] [bp-10h]@3 - int v8; // [sp-8h] [bp-Ch]@3 - __int16 v9; // [sp-4h] [bp-8h]@3 - result = a2 - 1; v4 = PID(OBJECT_Actor,uActorID); switch ( a2 ) { case 1: if ( a3 ) { - v9 = 0; - v8 = (signed __int64)(sub_43AE12(a3) * 65536.0); - v7 = 0; - LOWORD(v6) = v4; - v5 = 904; - goto LABEL_16; + pOtherOverlayList->_4418B6(904, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0); } return; case 2: if ( a3 ) { - v9 = 0; - v8 = (signed __int64)(sub_43AE12(a3) * 65536.0); - v7 = 0; - LOWORD(v6) = v4; - v5 = 905; - goto LABEL_16; + pOtherOverlayList->_4418B6(905, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0); } return; case 3: if ( a3 ) { - v9 = 0; - v8 = (signed __int64)(sub_43AE12(a3) * 65536.0); - v7 = 0; - LOWORD(v6) = v4; - v5 = 906; - goto LABEL_16; + pOtherOverlayList->_4418B6(906, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0); } return; case 4: if ( a3 ) { - v9 = 0; - v8 = (signed __int64)(sub_43AE12(a3) * 65536.0); - v7 = 0; - LOWORD(v6) = v4; - v5 = 907; - goto LABEL_16; + pOtherOverlayList->_4418B6(907, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0); } return; case 5: - v9 = 4; - v8 = 65536; - v7 = 0; - v6 = PID(OBJECT_Actor,uActorID); - v5 = 901; - goto LABEL_16; + pOtherOverlayList->_4418B6(901, v4, 0, PID(OBJECT_Actor,uActorID), 0); + return; case 6: - v9 = 4; - v8 = 65536; - v7 = 0; - v6 = PID(OBJECT_Actor,uActorID); - v5 = 902; - goto LABEL_16; + pOtherOverlayList->_4418B6(902, v4, 0, PID(OBJECT_Actor,uActorID), 0); + return; case 7: - v9 = 4; - v8 = 65536; - v7 = 0; - v6 = PID(OBJECT_Actor,uActorID); - v5 = 903; - goto LABEL_16; + pOtherOverlayList->_4418B6(903, v4, 0, PID(OBJECT_Actor,uActorID), 0); + return; case 8: - v9 = 4; - v8 = 65536; - v7 = 0; - v6 = PID(OBJECT_Actor,uActorID); - v5 = 900; - goto LABEL_16; + pOtherOverlayList->_4418B6(900, v4, 0, PID(OBJECT_Actor,uActorID), 0); + return; case 9: - v9 = 4; - v8 = 65536; - v7 = 0; - v6 = PID(OBJECT_Actor,uActorID); - v5 = 909; - goto LABEL_16; + pOtherOverlayList->_4418B6(909, v4, 0, PID(OBJECT_Actor,uActorID), 0); + return; case 10: - v9 = 4; - v8 = 65536; - v7 = 0; - v6 = PID(OBJECT_Actor,uActorID); - v5 = 908; -LABEL_16: - result = pOtherOverlayList->_4418B6(v5, v6, v7, v8, v9); - break; + pOtherOverlayList->_4418B6(908, v4, 0, PID(OBJECT_Actor,uActorID), 0); + return; default: return; } @@ -1492,13 +1393,12 @@ } //----- (0043B3E0) -------------------------------------------------------- -int Actor::_43B3E0_CalcDamage(Actor *a1, signed int a2) +int Actor::_43B3E0_CalcDamage( signed int dmgSource ) { signed int v2; // ebp@1 int v3; // eax@9 signed int v4; // edi@9 int v5; // esi@9 - int v6; // ebx@11 unsigned __int16 v8; // si@21 int v9; // edi@21 signed int v10; // eax@23 @@ -1506,61 +1406,47 @@ v2 = 0; v11 = 0; - if ( a2 ) + + switch( dmgSource ) { - if ( a2 == 1 ) - { - v3 = a1->pMonsterInfo.uAttack2DamageDiceRolls; - v4 = a1->pMonsterInfo.uAttack2DamageDiceSides; - v5 = a1->pMonsterInfo.uAttack2DamageBonus; - } - else - { - if ( a2 <= 1 ) - return 0; - if ( a2 <= 3 ) - { - if ( a2 == 2 ) - { - v8 = a1->pMonsterInfo.uSpellSkillAndMastery1; - v9 = a1->pMonsterInfo.uSpell1ID; - } - else - { - v8 = a1->pMonsterInfo.uSpellSkillAndMastery2; - v9 = a1->pMonsterInfo.uSpell2ID; - } - v10 = SkillToMastery(v8); - return _43AFE3_calc_spell_damage(v9, v8 & 0x3F, v10, 0); - } - if ( a2 != 4 ) - return 0; - v3 = a1->pMonsterInfo.uSpecialAbilityDamageDiceRolls; - v4 = a1->pMonsterInfo.uSpecialAbilityDamageDiceSides; - v5 = a1->pMonsterInfo.uSpecialAbilityDamageDiceBonus; - } + case 0: + if ( this->pActorBuffs[14].uExpireTime > 0 ) + v2 = this->pActorBuffs[14].uPower; + if ( this->pActorBuffs[18].uExpireTime > 0 && this->pActorBuffs[18].uPower > v2 ) + v2 = this->pActorBuffs[18].uPower; + if ( this->pActorBuffs[21].uExpireTime > 0 ) + v2 += this->pActorBuffs[21].uPower; + v3 = this->pMonsterInfo.uAttack1DamageDiceRolls; + v4 = this->pMonsterInfo.uAttack1DamageDiceSides; + v5 = this->pMonsterInfo.uAttack1DamageBonus; + break; + case 1: + v3 = this->pMonsterInfo.uAttack2DamageDiceRolls; + v4 = this->pMonsterInfo.uAttack2DamageDiceSides; + v5 = this->pMonsterInfo.uAttack2DamageBonus; + break; + case 2: + v8 = this->pMonsterInfo.uSpellSkillAndMastery1; + v9 = this->pMonsterInfo.uSpell1ID; + v10 = SkillToMastery(v8); + return _43AFE3_calc_spell_damage(v9, v8 & 0x3F, v10, 0); + break; + case 3: + v8 = this->pMonsterInfo.uSpellSkillAndMastery2; + v9 = this->pMonsterInfo.uSpell2ID; + v10 = SkillToMastery(v8); + return _43AFE3_calc_spell_damage(v9, v8 & 0x3F, v10, 0); + break; + case 4: + v3 = this->pMonsterInfo.uSpecialAbilityDamageDiceRolls; + v4 = this->pMonsterInfo.uSpecialAbilityDamageDiceSides; + v5 = this->pMonsterInfo.uSpecialAbilityDamageDiceBonus; + default: + return 0; } - else + for ( int i = 0; i < v3; i++) { - if ( (signed __int64)a1->pActorBuffs[14].uExpireTime > 0 ) - v2 = a1->pActorBuffs[14].uPower; - if ( (signed __int64)a1->pActorBuffs[18].uExpireTime > 0 && a1->pActorBuffs[18].uPower > v2 ) - v2 = a1->pActorBuffs[18].uPower; - if ( (signed __int64)a1->pActorBuffs[21].uExpireTime > 0 ) - v2 += a1->pActorBuffs[21].uPower; - v3 = a1->pMonsterInfo.uAttack1DamageDiceRolls; - v4 = a1->pMonsterInfo.uAttack1DamageDiceSides; - v5 = a1->pMonsterInfo.uAttack1DamageBonus; - } - if ( v3 > 0 ) - { - v6 = v3; - do - { - --v6; - v11 += rand() % v4 + 1; - } - while ( v6 ); + v11 += rand() % v4 + 1; } return v11 + v5 + v2; } @@ -1580,22 +1466,16 @@ } //----- (0042EBEE) -------------------------------------------------------- -bool Actor::StealFrom(unsigned int uActorID) +void Actor::StealFrom( unsigned int uActorID ) { - unsigned int v1; // esi@1 Player *pPlayer; // edi@1 - bool result; // eax@1 int v4; // ebx@2 unsigned int v5; // eax@2 DDM_DLV_Header *v6; // esi@4 - unsigned int v7; // [sp+8h] [bp-4h]@1 int v8; // [sp+8h] [bp-4h]@6 - v1 = uActiveCharacter; - v7 = uActorID; pPlayer = &pParty->pPlayers[uActiveCharacter-1]; - result = pPlayer->CanAct(); - if ( result ) + if ( pPlayer->CanAct() ) { CastSpellInfoHelpers::_427D48(); v4 = 0; @@ -1605,113 +1485,90 @@ v6 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) v6 = &pIndoor->dlv; - pPlayer->StealFromActor(v7, v4, v6->uReputation++); + pPlayer->StealFromActor(uActorID, v4, v6->uReputation++); v8 = pPlayer->GetAttackRecoveryTime(0); if ( v8 < 30 ) v8 = 30; if ( !pParty->bTurnBasedModeOn ) - pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v8 * 2.133333333333333)); + pPlayer->SetRecoveryTime((int)(flt_6BE3A4_debug_recmod1 * v8 * 2.133333333333333)); pTurnEngine->ApplyPlayerAction(); - result = 1; } - return result; + return; } //----- (00403A60) -------------------------------------------------------- void Actor::AI_SpellAttack2(unsigned int uActorID, signed int edx0, AIDirection *pDir) { Actor *v3; // ebx@1 - AIDirection *v4; // esi@3 - AIDirection *v5; // edi@3 + int16_t v4; // esi@3 + int16_t v5; // edi@3 signed int v6; // eax@4 Vec3_int_ v7; // ST04_12@6 - //unsigned int result; // eax@7 AIDirection *v9; // eax@8 - unsigned int v10; // esi@8 - AIDirection *v11; // esi@9 - SpriteFrame *v12; // ecx@10 __int16 v13; // ax@10 - unsigned int v14; // ecx@10 - unsigned int v15; // eax@10 - signed int v16; // ecx@17 AIDirection a3; // [sp+Ch] [bp-48h]@9 AIDirection v18; // [sp+28h] [bp-2Ch]@9 int v19; // [sp+44h] [bp-10h]@6 signed int a2; // [sp+48h] [bp-Ch]@1 int v21; // [sp+4Ch] [bp-8h]@3 - unsigned int v22; // [sp+50h] [bp-4h]@1 unsigned int pDira; // [sp+5Ch] [bp+8h]@10 - v22 = uActorID; v3 = &pActors[uActorID]; a2 = edx0; if ( PID_TYPE(edx0) == OBJECT_Actor) { v6 = PID_ID(edx0); - v4 = (AIDirection *)pActors[v6].vPosition.x; - v5 = (AIDirection *)pActors[v6].vPosition.y; - v21 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z); + v4 = pActors[v6].vPosition.x; + v5 = pActors[v6].vPosition.y; + v21 = (int)(pActors[v6].uActorHeight * 0.75 + pActors[v6].vPosition.z); + } + else if ( PID_TYPE(edx0) == OBJECT_Player) + { + v4 = pParty->vPosition.x; + v5 = pParty->vPosition.y; + v21 = pParty->vPosition.z + pParty->sEyelevel; } else { - if ( PID_TYPE(edx0) == OBJECT_Player) + Error("Should not get here"); + return; + } + v19 = v3->uActorHeight; + v7.z = v3->vPosition.z - (int)(v19 * -0.75); + v7.y = v3->vPosition.y; + v7.x = v3->vPosition.x; + if ( sub_407A1C(v4, v5, v21, v7) ) + { + if ( pDir == nullptr) { - v4 = (AIDirection *)pParty->vPosition.x; - v5 = (AIDirection *)pParty->vPosition.y; - v21 = pParty->vPosition.z + pParty->sEyelevel; + v9 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), a2, &a3, 0); } else { - v4 = pDir; - v5 = pDir; + v9 = pDir; } - } - v19 = v3->uActorHeight; - v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75); - v7.y = v3->vPosition.y; - v7.x = v3->vPosition.x; - if ( sub_407A1C((int)v4, (int)v5, v21, v7) ) - { - v9 = pDir; - v10 = 0; - if ( !pDir ) + v3->uYawAngle = LOWORD(v9->uYawAngle); + v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; + v3->uCurrentActionLength = 8 * v13; + v3->uCurrentActionTime = 0; + v3->uAIState = AttackingRanged4; + Actor::PlaySound(uActorID, 0); + pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; + if (v3->pActorBuffs[7].uExpireTime > 0) { - v11 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v22), a2, &a3, 0); - v9 = &v18; - memcpy(&v18, v11, sizeof(v18)); - v10 = 0; - } - v12 = pSpriteFrameTable->pSpriteSFrames; - v3->uYawAngle = LOWORD(v9->uYawAngle); - v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; - v14 = v22; - v3->uCurrentActionLength = 8 * v13; - v3->uCurrentActionTime = v10; - v3->uAIState = AttackingRanged4; - Actor::PlaySound(v14, 0); - v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 - && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) - { - v15 *= 2; - pDira = v15; + pDira *= 2; } if ( pParty->bTurnBasedModeOn == 1 ) - v3->pMonsterInfo.uRecoveryTime = v15; + v3->pMonsterInfo.uRecoveryTime = pDira; else - v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength - - (unsigned int)(signed __int64)(flt_6BE3A8_debug_recmod2 - * (double)(signed int)pDira - * -2.133333333333333); - v16 = v3->pMonsterInfo.uSpell2ID; - v3->vVelocity.z = v10; - v3->vVelocity.y = v10; - v3->vVelocity.x = v10; - if ( _42FB5C_check_spell(v16) ) + v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength + (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); + v3->vVelocity.z = 0; + v3->vVelocity.y = 0; + v3->vVelocity.x = 0; + if ( _42FB5C_check_spell(v3->pMonsterInfo.uSpell2ID) ) { v3->uCurrentActionLength = 64; - v3->uCurrentActionTime = v10; + v3->uCurrentActionTime = 0; v3->uAIState = Fidgeting; v3->UpdateAnimation(); v3->uAIState = AttackingRanged4; @@ -1720,104 +1577,82 @@ v3->UpdateAnimation(); } else - Actor::AI_Pursue1(v22, a2, v22, 64, pDir); + Actor::AI_Pursue1(uActorID, a2, uActorID, 64, pDir); } //----- (00403854) -------------------------------------------------------- void Actor::AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) { Actor *v3; // ebx@1 - AIDirection *v4; // esi@3 - AIDirection *v5; // edi@3 + int16_t v4; // esi@3 + int16_t v5; // edi@3 signed int v6; // eax@4 Vec3_int_ v7; // ST04_12@6 - //unsigned int result; // eax@7 AIDirection *v9; // eax@8 - unsigned int v10; // esi@8 - AIDirection *v11; // esi@9 - SpriteFrame *v12; // ecx@10 __int16 v13; // ax@10 - unsigned int v14; // ecx@10 - unsigned int v15; // eax@10 signed int v16; // ecx@17 AIDirection a3; // [sp+Ch] [bp-48h]@9 AIDirection v18; // [sp+28h] [bp-2Ch]@9 int v19; // [sp+44h] [bp-10h]@6 - //signed int a2; // [sp+48h] [bp-Ch]@1 int v21; // [sp+4Ch] [bp-8h]@3 - unsigned int v22; // [sp+50h] [bp-4h]@1 unsigned int pDira; // [sp+5Ch] [bp+8h]@10 - v22 = uActorID; v3 = &pActors[uActorID]; - //a2 = edx0; if ( PID_TYPE(sTargetPid) == OBJECT_Actor) { v6 = PID_ID(sTargetPid); - v4 = (AIDirection *)pActors[v6].vPosition.x; - v5 = (AIDirection *)pActors[v6].vPosition.y; - v21 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z); + v4 = pActors[v6].vPosition.x; + v5 = pActors[v6].vPosition.y; + v21 = (int)(pActors[v6].uActorHeight * 0.75 + pActors[v6].vPosition.z); + } + else if ( PID_TYPE(sTargetPid) == OBJECT_Player) + { + v4 = pParty->vPosition.x; + v5 = pParty->vPosition.y; + v21 = pParty->vPosition.z + pParty->sEyelevel; } else { - if ( PID_TYPE(sTargetPid) == OBJECT_Player) + Error("Should not get here"); + return; + } + v19 = v3->uActorHeight; + v7.z = v3->vPosition.z - (int)(v19 * -0.75); + v7.y = v3->vPosition.y; + v7.x = v3->vPosition.x; + if ( sub_407A1C(v4, v5, v21, v7) ) + { + if ( pDir == nullptr ) { - v4 = (AIDirection *)pParty->vPosition.x; - v5 = (AIDirection *)pParty->vPosition.y; - v21 = pParty->vPosition.z + pParty->sEyelevel; + v9 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), sTargetPid, &a3, 0); } else { - v4 = pDir; - v5 = pDir; + v9 = pDir; } - } - v19 = v3->uActorHeight; - v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75); - v7.y = v3->vPosition.y; - v7.x = v3->vPosition.x; - if ( sub_407A1C((int)v4, (int)v5, v21, v7) ) - { - v9 = pDir; - v10 = 0; - if ( !pDir ) + v3->uYawAngle = LOWORD(v9->uYawAngle); + v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; + v3->uCurrentActionLength = 8 * v13; + v3->uCurrentActionTime = 0; + v3->uAIState = AttackingRanged3; + Actor::PlaySound(uActorID, 0); + pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; + if (v3->pActorBuffs[7].uExpireTime > 0) { - v11 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v22), sTargetPid, &a3, 0); - v9 = &v18; - memcpy(&v18, v11, sizeof(v18)); - v10 = 0; - } - v12 = pSpriteFrameTable->pSpriteSFrames; - v3->uYawAngle = LOWORD(v9->uYawAngle); - v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; - v14 = v22; - v3->uCurrentActionLength = 8 * v13; - v3->uCurrentActionTime = v10; - v3->uAIState = AttackingRanged3; - Actor::PlaySound(v14, 0); - v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 - && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) - { - v15 *= 2; - pDira = v15; + pDira *= 2; } if ( pParty->bTurnBasedModeOn == 1 ) - v3->pMonsterInfo.uRecoveryTime = v15; + v3->pMonsterInfo.uRecoveryTime = pDira; else - v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength - - (unsigned int)(signed __int64)(flt_6BE3A8_debug_recmod2 - * (double)(signed int)pDira - * -2.133333333333333); + v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength + (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); v16 = v3->pMonsterInfo.uSpell1ID; - v3->vVelocity.z = v10; - v3->vVelocity.y = v10; - v3->vVelocity.x = v10; + v3->vVelocity.z = 0; + v3->vVelocity.y = 0; + v3->vVelocity.x = 0; if ( _42FB5C_check_spell(v16) ) { v3->uCurrentActionLength = 64; - v3->uCurrentActionTime = v10; + v3->uCurrentActionTime = 0; v3->uAIState = Fidgeting; v3->UpdateAnimation(); v3->uAIState = AttackingRanged3; @@ -1826,98 +1661,82 @@ v3->UpdateAnimation(); } else - Actor::AI_Pursue1(v22, sTargetPid, v22, 64, pDir); + Actor::AI_Pursue1(uActorID, sTargetPid, uActorID, 64, pDir); } //----- (0040368B) -------------------------------------------------------- void Actor::AI_MissileAttack2(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) { Actor *v3; // ebx@1 - AIDirection *v4; // esi@3 - AIDirection *v5; // edi@3 + int16_t v4; // esi@3 + int16_t v5; // edi@3 signed int v6; // eax@4 Vec3_int_ v7; // ST04_12@6 - //unsigned int result; // eax@7 AIDirection *v9; // eax@8 - unsigned int v10; // esi@8 - AIDirection *v11; // esi@9 - SpriteFrame *v12; // ecx@10 __int16 v13; // ax@10 - unsigned int v14; // ecx@10 - signed __int64 v15; // qax@10 AIDirection a3; // [sp+Ch] [bp-48h]@9 AIDirection v17; // [sp+28h] [bp-2Ch]@9 int v18; // [sp+44h] [bp-10h]@6 - //signed int a2; // [sp+48h] [bp-Ch]@1 int v20; // [sp+4Ch] [bp-8h]@3 - unsigned int v21; // [sp+50h] [bp-4h]@1 unsigned int pDira; // [sp+5Ch] [bp+8h]@10 - v21 = uActorID; v3 = &pActors[uActorID]; - //a2 = edx0; if ( PID_TYPE(sTargetPid) == OBJECT_Actor) { v6 = PID_ID(sTargetPid); - v4 = (AIDirection *)pActors[v6].vPosition.x; - v5 = (AIDirection *)pActors[v6].vPosition.y; - v20 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z); + v4 = pActors[v6].vPosition.x; + v5 = pActors[v6].vPosition.y; + v20 = (int)(pActors[v6].uActorHeight * 0.75 + pActors[v6].vPosition.z); + } + else if ( PID_TYPE(sTargetPid) == OBJECT_Player) + { + v4 = pParty->vPosition.x; + v5 = pParty->vPosition.y; + v20 = pParty->vPosition.z + pParty->sEyelevel; } else { - if ( PID_TYPE(sTargetPid) == OBJECT_Player) + Error("Should not get here"); + return; + } + v18 = v3->uActorHeight; + v7.z = v3->vPosition.z - (int)(v18 * -0.75); + v7.y = v3->vPosition.y; + v7.x = v3->vPosition.x; + if ( sub_407A1C(v4, v5, v20, v7) ) + { + if ( pDir == nullptr ) { - v4 = (AIDirection *)pParty->vPosition.x; - v5 = (AIDirection *)pParty->vPosition.y; - v20 = pParty->vPosition.z + pParty->sEyelevel; + v9 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), sTargetPid, &a3, 0); } else { - v4 = pDir; - v5 = pDir; + v9 = pDir; } - } - v18 = v3->uActorHeight; - v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v18 * -0.75); - v7.y = v3->vPosition.y; - v7.x = v3->vPosition.x; - if ( sub_407A1C((int)v4, (int)v5, v20, v7) ) - { - v9 = pDir; - v10 = 0; - if ( !pDir ) + v3->uYawAngle = LOWORD(v9->uYawAngle); + v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; + v3->uCurrentActionLength = 8 * v13; + v3->uCurrentActionTime = 0; + v3->uAIState = AttackingRanged2; + Actor::PlaySound(uActorID, 0); + pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; + if ( v3->pActorBuffs[7].uExpireTime > 0 ) { - v11 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v21), sTargetPid, &a3, 0); - v9 = &v17; - memcpy(&v17, v11, sizeof(v17)); - v10 = 0; - } - v12 = pSpriteFrameTable->pSpriteSFrames; - v3->uYawAngle = LOWORD(v9->uYawAngle); - v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; - v14 = v21; - v3->uCurrentActionLength = 8 * v13; - v3->uCurrentActionTime = v10; - v3->uAIState = AttackingRanged2; - Actor::PlaySound(v14, 0); - LODWORD(v15) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 - && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) - { - LODWORD(v15) = 2 * v15; - pDira = v15; + pDira *= 2; } if ( pParty->bTurnBasedModeOn != 1 ) - v15 = (signed __int64)(flt_6BE3A8_debug_recmod2 * (double)(signed int)pDira * 2.133333333333333); - v3->pMonsterInfo.uRecoveryTime = v15; - v3->vVelocity.z = v10; - v3->vVelocity.y = v10; - v3->vVelocity.x = v10; + v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); + else + { + v3->pMonsterInfo.uRecoveryTime = pDira; + } + v3->vVelocity.z = 0; + v3->vVelocity.y = 0; + v3->vVelocity.x = 0; v3->UpdateAnimation(); } else - Actor::AI_Pursue1(v21, sTargetPid, v21, 64, pDir); + Actor::AI_Pursue1(uActorID, sTargetPid, uActorID, 64, pDir); } //----- (00403476) -------------------------------------------------------- @@ -1928,24 +1747,15 @@ int v5; // edi@3 signed int v6; // eax@4 Vec3_int_ v7; // ST04_12@6 - unsigned char v8[12]; // ST04_12@7 - //unsigned int result; // eax@8 AIDirection *v10; // eax@9 - unsigned int v11; // esi@9 - AIDirection *v12; // esi@10 - SpriteFrame *v13; // ecx@11 __int16 v14; // ax@11 - unsigned int v15; // ecx@11 - unsigned int v16; // eax@11 AIDirection a3; // [sp+Ch] [bp-48h]@10 AIDirection v18; // [sp+28h] [bp-2Ch]@10 int v19; // [sp+44h] [bp-10h]@6 //signed int a2; // [sp+48h] [bp-Ch]@1 - unsigned int v21; // [sp+4Ch] [bp-8h]@1 int v22; // [sp+50h] [bp-4h]@3 unsigned int pDira; // [sp+5Ch] [bp+8h]@11 - v21 = uActorID; v3 = &pActors[uActorID]; //a2 = edx0; if ( PID_TYPE(sTargetPid) == OBJECT_Actor) @@ -1953,7 +1763,7 @@ v6 = PID_ID(sTargetPid); v4 = pActors[v6].vPosition.x; v5 = pActors[v6].vPosition.y; - v22 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z); + v22 = (int)(pActors[v6].uActorHeight * 0.75 + pActors[v6].vPosition.z); } else { @@ -1973,134 +1783,105 @@ v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75); v7.y = v3->vPosition.y; v7.x = v3->vPosition.x; - if ( sub_407A1C(v4, v5, v22, v7) - || (*(unsigned int *)&v8[8] = v22, - v19 = v3->uActorHeight, - *(_QWORD *)v8 = __PAIR__(v5, v4), - sub_407A1C( - v3->vPosition.x, - v3->vPosition.y, - v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75), - *(Vec3_int_ *)v8)) ) + if ( sub_407A1C(v4, v5, v22, v7) || sub_407A1C(v7.x, v7.y, v7.z, Vec3_int_(v4, v5, v22))) { - v10 = pDir; - v11 = 0; - if ( !pDir ) + if ( pDir == nullptr ) + { + v10 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), sTargetPid, &a3, 0); + } + else { - v12 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v21), sTargetPid, &a3, 0); - v10 = &v18; - memcpy(&v18, v12, sizeof(v18)); - v11 = 0; + v10 = pDir; } - v13 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v10->uYawAngle); - v14 = v13[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; - v15 = v21; + v14 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v3->uCurrentActionLength = 8 * v14; - v3->uCurrentActionTime = v11; + v3->uCurrentActionTime = 0; v3->uAIState = AttackingRanged1; - Actor::PlaySound(v15, 0); - v16 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; + Actor::PlaySound(uActorID, 0); pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v11 - && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v11 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v11) ) + if ( v3->pActorBuffs[7].uExpireTime > 0 ) { - v16 *= 2; - pDira = v16; + pDira *= 2; } if ( pParty->bTurnBasedModeOn == 1 ) - v3->pMonsterInfo.uRecoveryTime = v16; + v3->pMonsterInfo.uRecoveryTime = pDira; else - v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength - - (unsigned int)(signed __int64)(flt_6BE3A8_debug_recmod2 - * (double)(signed int)pDira - * -2.133333333333333); - v3->vVelocity.z = v11; - v3->vVelocity.y = v11; - v3->vVelocity.x = v11; + v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength - (int)(flt_6BE3A8_debug_recmod2 * pDira * -2.133333333333333); + v3->vVelocity.z = 0; + v3->vVelocity.y = 0; + v3->vVelocity.x = 0; v3->UpdateAnimation(); } else - Actor::AI_Pursue1(v21, sTargetPid, v21, 64, pDir); + Actor::AI_Pursue1(uActorID, sTargetPid, uActorID, 64, pDir); } //----- (004032B2) -------------------------------------------------------- void Actor::AI_RandomMove( unsigned int uActor_id, unsigned int uTarget_id, int radius, int uActionLength ) - { - unsigned int v4; // edi@1 +{ Actor *v5; // esi@1 - int v6; // ebx@1 - int v7; // ST08_4@1 - int v8; // eax@1 + int x; // ebx@1 + int absy; // eax@1 unsigned int v9; // ebx@11 int v10; // ebx@13 - signed __int16 v11; // cx@17 - unsigned int v12; // [sp-8h] [bp-44h]@10 - AIDirection *v13; // [sp-4h] [bp-40h]@10 - AIDirection v14; // [sp+Ch] [bp-30h]@7 - int v15; // [sp+28h] [bp-14h]@11 + AIDirection doNotInitializeBecauseShouldBeRandom; // [sp+Ch] [bp-30h]@7 unsigned int v16; // [sp+2Ch] [bp-10h]@1 int y; // [sp+30h] [bp-Ch]@1 - unsigned int uActorID; // [sp+34h] [bp-8h]@1 - int v19; // [sp+38h] [bp-4h]@1 - - //v14 never filled, maybe it is passed to function but optimized away as local variable - - uActorID = uActor_id; - v4 = uActor_id; + int absx; // [sp+38h] [bp-4h]@1 + v5 = &pActors[uActor_id]; v16 = uTarget_id; - v6 = v5->vInitialPosition.x - v5->vPosition.x; - v7 = v5->vInitialPosition.x - v5->vPosition.x; + x = v5->vInitialPosition.x - v5->vPosition.x; y = v5->vInitialPosition.y - v5->vPosition.y; - v19 = abs(v7); - v8 = abs(y); - if ( v19 <= v8 ) - v19 = v8 + (v19 >> 1); + absx = abs(x); + absy = abs(y); + if ( absx <= absy ) + absx = absy + (absx / 2 ); else - v19 += v8 >> 1; + absx = absx + absy / 2; if ( MonsterStats::BelongsToSupertype(v5->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) { if ( !uActionLength ) uActionLength = 256; - Actor::AI_StandOrBored(uActorID, OBJECT_Player, uActionLength, &v14); + Actor::AI_StandOrBored(uActor_id, OBJECT_Player, uActionLength, &doNotInitializeBecauseShouldBeRandom); return; } - if ( pActors[v4].pMonsterInfo.uMovementType == 3 && v19 < 128 ) + if ( pActors[uActor_id].pMonsterInfo.uMovementType == 3 && absx < 128 ) { - Actor::AI_Stand(uActorID, uTarget_id, 256, &v14); + Actor::AI_Stand(uActor_id, uTarget_id, 256, &doNotInitializeBecauseShouldBeRandom); return; } - v15 = (rand() & 0xF) << 12; - v19 += (unsigned __int64)(v15 * (signed __int64)radius) >> 16; - v9 = (stru_5C6E00->uIntegerDoublePi - 1) & stru_5C6E00->Atan2(v6, y); + absx += ((rand() & 0xF) * radius) / 16; + v9 = (stru_5C6E00->uIntegerDoublePi - 1) & stru_5C6E00->Atan2(x, y); if ( rand() % 100 < 25 ) { - Actor::StandAwhile(uActorID); + Actor::StandAwhile(uActor_id); return; } v10 = v9 + rand() % 256 - 128; if ( abs(v10 - v5->uYawAngle) > 256 && !(v5->uAttributes & 0x200000) ) { - Actor::AI_Stand(uActorID, uTarget_id, 256, &v14); + Actor::AI_Stand(uActor_id, uTarget_id, 256, &doNotInitializeBecauseShouldBeRandom); return; } v5->uYawAngle = v10; if ( v5->uMovementSpeed) - v5->uCurrentActionLength = 32 * v19 / v5->uMovementSpeed; + v5->uCurrentActionLength = 32 * absx / v5->uMovementSpeed; else v5->uCurrentActionLength = 0; v5->uCurrentActionTime = 0; v5->uAIState = Tethered; if ( rand() % 100 < 2 ) - Actor::PlaySound(uActorID, 3u); + Actor::PlaySound(uActor_id, 3u); v5->UpdateAnimation(); } //----- (004031C1) -------------------------------------------------------- -char __fastcall Actor::_4031C1_update_job(unsigned int uActorID, signed int a2, int a3) +char __fastcall Actor::_4031C1_update_job_never_gets_called(unsigned int uActorID, signed int a2, int a3) //attempted to implement something like jobs for actors, but apparently was never finished { - unsigned int v3; // edi@1 + return 0; + /*unsigned int v3; // edi@1 Actor *v4; // esi@1 ActorJob *v5; // eax@1 signed int v6; // edx@2 @@ -2152,55 +1933,44 @@ } } } - return (char)v5; + return (char)v5;*/ } //----- (004030AD) -------------------------------------------------------- -void Actor::AI_Stun(unsigned int uActorID, signed int edx0, int arg0) +void Actor::AI_Stun(unsigned int uActorID, signed int edx0, int stunRegardlessOfState) { - unsigned int v3; // edi@1 Actor *v4; // ebx@1 - //__int16 result; // ax@10 - SpriteFrame *v6; // ecx@16 __int16 v7; // ax@16 - unsigned int v8; // ecx@16 AIDirection a3; // [sp+Ch] [bp-40h]@16 - AIDirection v10; // [sp+28h] [bp-24h]@16 - unsigned int v11; // [sp+44h] [bp-8h]@1 - signed int a2; // [sp+48h] [bp-4h]@1 + AIDirection* v10; // [sp+28h] [bp-24h]@16 - v3 = uActorID; - a2 = edx0; v4 = &pActors[uActorID]; - v11 = uActorID; - if ( v4->uAIState == 7 ) + if ( v4->uAIState == Fleeing ) BYTE2(v4->uAttributes) |= 2u; if ( v4->pMonsterInfo.uHostilityType != 4 ) { v4->uAttributes &= 0xFFFFFFFBu; v4->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; } - if ( (signed __int64)v4->pActorBuffs[1].uExpireTime > 0 ) + if ( v4->pActorBuffs[1].uExpireTime > 0 ) v4->pActorBuffs[1].Reset(); - if ( (signed __int64)v4->pActorBuffs[4].uExpireTime > 0 ) + if ( v4->pActorBuffs[4].uExpireTime > 0 ) v4->pActorBuffs[4].Reset(); - if ( arg0 - || (v4->uAIState != 8 - && v4->uAIState != 3 - && v4->uAIState != 12 - && v4->uAIState != 13 - && v4->uAIState != 18 - && v4->uAIState != 2)) + if ( stunRegardlessOfState + || (v4->uAIState != Stunned + && v4->uAIState != AttackingRanged1 + && v4->uAIState != AttackingRanged2 + && v4->uAIState != AttackingRanged3 + && v4->uAIState != AttackingRanged4 + && v4->uAIState != AttackingMelee)) { - memcpy(&v10, Actor::GetDirectionInfo(PID(OBJECT_Actor,v3), a2, &a3, 0), sizeof(v10)); - v6 = pSpriteFrameTable->pSpriteSFrames; - v4->uYawAngle = LOWORD(v10.uYawAngle); - v7 = v6[v4->pSpriteIDs[ANIM_GotHit]].uAnimLength; - v8 = v11; + v10 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), edx0, &a3, 0), sizeof(v10); + v4->uYawAngle = LOWORD(v10->uYawAngle); + v7 = pSpriteFrameTable->pSpriteSFrames[v4->pSpriteIDs[ANIM_GotHit]].uAnimLength; v4->uCurrentActionTime = 0; v4->uAIState = Stunned; v4->uCurrentActionLength = 8 * v7; - Actor::PlaySound(v8, 2u); + Actor::PlaySound(uActorID, 2u); v4->UpdateAnimation(); } } @@ -2211,8 +1981,7 @@ unsigned int v7; // eax@3 unsigned int v9; // eax@3 - assert(uActorID < uNumActors); - auto actor = &pActors[uActorID]; + Actor* actor = &pActors[uActorID]; AIDirection a3; // [sp+Ch] [bp-5Ch]@2 if (!a4) @@ -2243,16 +2012,12 @@ void Actor::Resurrect(unsigned int uActorID) { Actor *pActor; // esi@1 - SpriteFrame *v2; // edx@1 - int v3; // eax@1 pActor = &pActors[uActorID]; - v2 = pSpriteFrameTable->pSpriteSFrames; - v3 = pActor->pSpriteIDs[ANIM_Dying]; pActor->uCurrentActionTime = 0; pActor->uAIState = Resurrected; pActor->uCurrentActionAnimation = ANIM_Dying; - pActor->uCurrentActionLength = 8 * v2[v3].uAnimLength; + pActor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[pActor->pSpriteIDs[ANIM_Dying]].uAnimLength; pActor->sCurrentHP = LOWORD(pActor->pMonsterInfo.uHP); Actor::PlaySound(uActorID, 1u); pActor->UpdateAnimation(); @@ -2325,81 +2090,51 @@ //----- (00402CED) -------------------------------------------------------- void Actor::PlaySound(unsigned int uActorID, unsigned int uSoundID) { - //Actor *v2; // eax@1 unsigned __int16 v3; // dx@1 - int v4; // eax@3 - int v5; // eax@4 - unsigned int v6; // eax@6 - //signed int v7; // eax@12 - signed int v8; // [sp-18h] [bp-1Ch]@10 - signed int v9; // [sp-14h] [bp-18h]@10 - int v10; // [sp-10h] [bp-14h]@10 - unsigned int v11; // [sp-Ch] [bp-10h]@10 - int v12; // [sp-8h] [bp-Ch]@10 - //v2 = &pActors[uActorID]; v3 = pActors[uActorID].pSoundSampleIDs[uSoundID]; if ( v3 ) { - if ( (signed __int64)pActors[uActorID].pActorBuffs[3].uExpireTime <= 0 ) + if ( pActors[uActorID].pActorBuffs[3].uExpireTime <= 0 ) { - v12 = 0; - v8 = -1; + pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); } else { - v4 = pActors[uActorID].pActorBuffs[3].uPower - 2; - if ( v4 ) + switch(pActors[uActorID].pActorBuffs[3].uPower) { - v5 = v4 - 1; - if ( v5 ) - { - if ( v5 == 1 ) - v6 = 55125; - else - v6 = uActorID; - } - else - { - v6 = 44100; - } + case 1: + pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, 0, 0, 0, 0, 33075); + break; + case 2: + pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, 0, 0, 0, 0, 33075); + break; + case 3: + case 4: + pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, 0, 0, 0, 0, 33075); + break; + default: + pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); + break; } - else - { - v6 = 33075; - } - v12 = v6; - v8 = 0; } - pAudioPlayer->PlaySound((SoundID)(signed __int16)v3, PID(OBJECT_Actor, uActorID), 0, v8, 0, 0, 0, v12); } } //----- (00402AD7) -------------------------------------------------------- void Actor::AI_Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir) { - unsigned int v5; // edi@1 int v6; // eax@1 Actor *v7; // ebx@1 unsigned int v8; // ecx@1 - char v9; // zf@1 AIDirection *v10; // esi@6 - //int v12; // ecx@19 - //unsigned int v13; // eax@19 AIDirection a3; // [sp+Ch] [bp-5Ch]@7 - //AIDirection v15; // [sp+28h] [bp-40h]@7 - AIDirection v16; // [sp+44h] [bp-24h]@7 - //unsigned int v17; // [sp+60h] [bp-8h]@1 unsigned int v18; // [sp+64h] [bp-4h]@1 - //int v19; // [sp+70h] [bp+8h]@19 - v5 = uActorID; v6 = 0; v7 = &pActors[uActorID]; - v18 = a2; v8 = PID(OBJECT_Actor,uActorID); - v9 = v7->pMonsterInfo.uFlying == 0; - if ( !v9 && !pParty->bFlying ) + if ( v7->pMonsterInfo.uFlying != 0 && !pParty->bFlying ) //TODO: Does v6 have a point? { if ( v7->pMonsterInfo.uMissleAttack1Type ) v6 = v7->uActorRadius + 512; @@ -2407,38 +2142,41 @@ v6 = pParty->uPartyHeight; } - v10 = pDir; - if ( !pDir ) + if ( pDir == nullptr ) { - memcpy(&v16, Actor::GetDirectionInfo(v8, a2, &a3, v6), sizeof(v16)); - v10 = &v16; + v10 = Actor::GetDirectionInfo(v8, a2, &a3, v6); + } + else + { + v10 = pDir; } if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) { if ( !uActionLength ) uActionLength = 256; - Actor::AI_StandOrBored(v5, 4, uActionLength, v10); + Actor::AI_StandOrBored(uActorID, 4, uActionLength, v10); return; } - if ( (double)(signed int)v10->uDistance < 307.2 ) + if ( v10->uDistance < 307.2 ) { if ( !uActionLength ) uActionLength = 256; - Actor::AI_Stand(v5, v18, uActionLength, v10); + Actor::AI_Stand(uActorID, a2, uActionLength, v10); return; } - if ( !v7->uMovementSpeed ) + if ( v7->uMovementSpeed == 0 ) { - Actor::AI_Stand(v5, v18, uActionLength, v10); + Actor::AI_Stand(uActorID, a2, uActionLength, v10); return; } - v18 = 16; if ( arg0 % 2 ) v18 = -16; + else + v18 = 16; v7->uYawAngle = stru_5C6E00->Atan2( - pParty->vPosition.x + fixpoint_mul(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.x, - pParty->vPosition.y + fixpoint_mul(stru_5C6E00->Sin(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.y); + pParty->vPosition.x + (int)fixpoint_mul(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.x, + pParty->vPosition.y + (int)fixpoint_mul(stru_5C6E00->Sin(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.y); if ( uActionLength ) v7->uCurrentActionLength = uActionLength; else @@ -2451,49 +2189,33 @@ //----- (00402968) -------------------------------------------------------- void Actor::AI_Flee(unsigned int uActorID, signed int sTargetPid, int uActionLength, AIDirection *a4) { - unsigned int v4; // esi@1 Actor *v5; // ebx@1 - //unsigned int result; // eax@1 int v7; // ecx@2 - signed __int16 v8; // cx@10 unsigned __int16 v9; // ax@15 - AIDirection v10; // [sp+8h] [bp-7Ch]@4 - AIDirection a3; // [sp+24h] [bp-60h]@3 - AIDirection v12; // [sp+40h] [bp-44h]@3 - AIDirection v13; // [sp+5Ch] [bp-28h]@4 - signed int a1; // [sp+78h] [bp-Ch]@2 - unsigned int v15; // [sp+7Ch] [bp-8h]@1 - //signed int a2; // [sp+80h] [bp-4h]@1 + AIDirection* v10 = nullptr; // [sp+8h] [bp-7Ch]@4 + AIDirection* a3 = nullptr; // [sp+24h] [bp-60h]@3 + AIDirection* v13; // [sp+5Ch] [bp-28h]@4 - v4 = uActorID; - //a2 = edx0; - v15 = uActorID; v5 = &pActors[uActorID]; - //result = pActors[uActorID].CanAct(); - if ( pActors[uActorID].CanAct() ) + if ( v5->CanAct() ) { - v7 = PID(OBJECT_Actor,v4); - a1 = PID(OBJECT_Actor,v4); + v7 = PID(OBJECT_Actor,uActorID); if ( !a4 ) { - a4 = &v12; - memcpy(&v12, Actor::GetDirectionInfo(v7, sTargetPid, &a3, v5->pMonsterInfo.uFlying), sizeof(v12)); - v7 = a1; + a4 = Actor::GetDirectionInfo(v7, sTargetPid, a3, v5->pMonsterInfo.uFlying); } - memcpy(&a3, Actor::GetDirectionInfo(v7, 4u, &v10, 0), sizeof(a3)); - memcpy(&v13, &a3, sizeof(v13)); + v13 = Actor::GetDirectionInfo(v7, 4u, v10, 0); if ( MonsterStats::BelongsToSupertype(v5->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) - || PID_TYPE(sTargetPid) == OBJECT_Actor && (double)(signed int)v13.uDistance < 307.2 ) + || PID_TYPE(sTargetPid) == OBJECT_Actor && v13->uDistance < 307.2 ) { if ( !uActionLength ) uActionLength = 256; - Actor::AI_StandOrBored(v15, 4, uActionLength, &v13); + Actor::AI_StandOrBored(uActorID, 4, uActionLength, v13); } else { - v8 = v5->uMovementSpeed; - if ( v8 ) - v5->uCurrentActionLength = (signed int)(a4->uDistanceXZ << 7) / v8; + if ( v5->uMovementSpeed ) + v5->uCurrentActionLength = (signed int)(a4->uDistanceXZ << 7) / v5->uMovementSpeed; else v5->uCurrentActionLength = 0; if ( v5->uCurrentActionLength > 256 ) @@ -2512,30 +2234,19 @@ //----- (0040281C) -------------------------------------------------------- void Actor::AI_Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5) { - unsigned int v5; // edi@1 int v6; // eax@1 Actor *v7; // ebx@1 unsigned int v8; // ecx@1 - char v9; // zf@1 AIDirection *v10; // esi@7 - signed int v11; // edx@12 signed __int16 v13; // cx@19 unsigned __int16 v14; // ax@25 - int v15; // [sp-8h] [bp-54h]@12 - AIDirection *v16; // [sp-4h] [bp-50h]@12 AIDirection a3; // [sp+Ch] [bp-40h]@8 AIDirection v18; // [sp+28h] [bp-24h]@8 - unsigned int v19; // [sp+44h] [bp-8h]@1 - unsigned int v20; // [sp+48h] [bp-4h]@1 - v5 = uActorID; v6 = 0; v7 = &pActors[uActorID]; - v19 = a2; v8 = PID(OBJECT_Actor,uActorID); - v9 = v7->pMonsterInfo.uFlying == 0; - v20 = v5; - if ( !v9 && !pParty->bFlying ) + if ( v7->pMonsterInfo.uFlying != 0 && !pParty->bFlying ) { if ( v7->pMonsterInfo.uMissleAttack1Type && uCurrentlyLoadedLevelType == LEVEL_Outdoor ) v6 = v7->uActorRadius + 512; @@ -2545,29 +2256,20 @@ v10 = pDir; if ( !pDir ) { - memcpy(&v18, Actor::GetDirectionInfo(v8, a2, &a3, v6), sizeof(v18)); - memcpy(0, &v18, 0x1Cu); - v10 = 0; - v5 = v20; + v10 = Actor::GetDirectionInfo(v8, a2, &a3, v6); } if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) { if ( !uActionLength ) uActionLength = 256; - v16 = v10; - v15 = uActionLength; - v11 = 4; - Actor::AI_StandOrBored(v5, v11, v15, v16); + Actor::AI_StandOrBored(uActorID, 4, uActionLength, v10); return; } if ( (signed int)v10->uDistance < a5 ) { if ( !uActionLength ) uActionLength = 256; - v11 = v19; - v16 = v10; - v15 = uActionLength; - Actor::AI_StandOrBored(v5, v11, v15, v16); + Actor::AI_StandOrBored(uActorID, a2, uActionLength, v10); return; } if ( uActionLength ) @@ -2595,31 +2297,19 @@ //----- (00402686) -------------------------------------------------------- void Actor::AI_Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4) { - //unsigned int v4; // edi@1 int v5; // eax@1 Actor *v6; // ebx@1 int v7; // ecx@1 - char v8; // zf@1 - //AIDirection *v9; // esi@7 - signed int v10; // edx@12 signed __int16 v12; // cx@19 - int v13; // edx@25 __int16 v14; // ax@25 - unsigned __int16 v15; // ax@26 unsigned __int16 v16; // ax@28 - int v17; // [sp-8h] [bp-54h]@12 - //AIDirection *v18; // [sp-4h] [bp-50h]@12 AIDirection a3; // [sp+Ch] [bp-40h]@8 - AIDirection v20; // [sp+28h] [bp-24h]@8 - int v21; // [sp+44h] [bp-8h]@1 - //unsigned int v22; // [sp+48h] [bp-4h]@1 + AIDirection* v20; // [sp+28h] [bp-24h]@8 v5 = 0; v6 = &pActors[uActorID]; - v21 = a2; v7 = PID(OBJECT_Actor,uActorID); - v8 = v6->pMonsterInfo.uFlying == 0; - if ( !v8 && !pParty->bFlying ) + if ( v6->pMonsterInfo.uFlying != 0 && !pParty->bFlying ) { if ( v6->pMonsterInfo.uMissleAttack1Type && uCurrentlyLoadedLevelType == LEVEL_Outdoor ) v5 = v6->uActorRadius + 512; @@ -2628,7 +2318,7 @@ } if ( !a4 ) { - memcpy(&v20, Actor::GetDirectionInfo(v7, a2, &a3, v5), sizeof(v20)); + v20 = Actor::GetDirectionInfo(v7, a2, &a3, v5); } if ( MonsterStats::BelongsToSupertype(v6->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) { @@ -2636,11 +2326,11 @@ uActionLength = 256; return Actor::AI_StandOrBored(uActorID, 4, uActionLength, a4); } - if ( (double)(signed int)a4->uDistance < 307.2 ) + if ( a4->uDistance < 307.2 ) { if ( !uActionLength ) uActionLength = 256; - return Actor::AI_StandOrBored(uActorID, v21, uActionLength, a4); + return Actor::AI_StandOrBored(uActorID, a2, uActionLength, a4); } if ( uActionLength ) { @@ -2656,13 +2346,12 @@ if ( v6->uCurrentActionLength > 128 ) v6->uCurrentActionLength = 128; } - v13 = rand() % 2; v14 = LOWORD(a4->uYawAngle); - if ( v13 ) - v15 = v14 + 256; + if ( rand() % 2 ) + v14 += 256; else - v15 = v14 - 256; - v6->uYawAngle = v15; + v14 -= 256; + v6->uYawAngle = v14; v16 = LOWORD(a4->uPitchAngle); v6->uCurrentActionTime = 0; v6->uPitchAngle = v16; @@ -4199,7 +3888,7 @@ BYTE2(actor->uAttributes) &= 0x7Fu; if (BYTE2(actor->uAttributes) & 0x40) - Actor::_4031C1_update_job(i, pParty->uCurrentHour, 1); + Actor::_4031C1_update_job_never_gets_called(i, pParty->uCurrentHour, 1); } } //----- (00439474) --------------------------------------------------------
--- a/Actor.h Mon Oct 21 10:07:23 2013 +0600 +++ b/Actor.h Mon Oct 21 10:07:32 2013 +0600 @@ -45,20 +45,21 @@ ACTOR_BUFF_AFRAID = 4, ACTOR_BUFF_STONED = 5, ACTOR_BUFF_PARALYZED = 6, - - ACTOR_BUFF_BERSERK = 8, - - ACTOR_BUFF_FATE = 10, - ACTOR_BUFF_ENSLAVED = 11, - ACTOR_BUFF_DAY_OF_PROTECTION = 12, - ACTOR_BUFF_HOUR_OF_POWER = 13, - ACTOR_BUFF_SHIELD = 14, - ACTOR_BUFF_STONESKIN = 15, - ACTOR_BUFF_BLESS = 16, - ACTOR_BUFF_HEROISM = 17, - ACTOR_BUFF_HASTE = 18, - ACTOR_BUFF_PAIN_REFLECTION = 19, - ACTOR_BUFF_PAIN_HAMMERHANDS = 20, + ACTOR_BUFF_SLOWED = 7, + ACTOR_BUFF_SOMETHING_THAT_HALVES_AC = 8, + ACTOR_BUFF_BERSERK = 9, + ACTOR_BUFF_MASS_DISTORTION = 10, + ACTOR_BUFF_FATE = 11, + ACTOR_BUFF_ENSLAVED = 12, + ACTOR_BUFF_DAY_OF_PROTECTION = 13, + ACTOR_BUFF_HOUR_OF_POWER = 14, + ACTOR_BUFF_SHIELD = 15, + ACTOR_BUFF_STONESKIN = 16, + ACTOR_BUFF_BLESS = 17, + ACTOR_BUFF_HEROISM = 18, + ACTOR_BUFF_HASTE = 19, + ACTOR_BUFF_PAIN_REFLECTION = 20, + ACTOR_BUFF_PAIN_HAMMERHANDS = 21, }; @@ -216,7 +217,7 @@ static void Resurrect(unsigned int uActorID); static void AI_Bored(unsigned int uActorID, unsigned int uObjID, struct AIDirection *a4); static void AI_Stun(unsigned int uActorID, signed int edx0, int arg0); - static char __fastcall _4031C1_update_job(unsigned int uActorID, signed int a2, int a3); + static char __fastcall _4031C1_update_job_never_gets_called(unsigned int uActorID, signed int a2, int a3); static void AI_RandomMove(unsigned int uActor_id, unsigned int uTarget_id, int radius, int uActionLength); static void AI_MissileAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); static void AI_MissileAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); @@ -236,12 +237,12 @@ static void AggroSurroundingPeasants(unsigned int uActorID, int a2); static bool ArePeasantsOfSameFaction(Actor *a1, Actor *a2); - static bool StealFrom(unsigned int uActorID); + static void StealFrom(unsigned int uActorID); static void GiveItem(signed int uActorID, unsigned int uItemID, unsigned int bGive); static void ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle); static void ApplyFineForKillingPeasant(unsigned int uActorID); static void DrawHealthBar(Actor *actor, struct GUIWindow *window); - static int _43B3E0_CalcDamage(Actor *a1, signed int a2); + int _43B3E0_CalcDamage(signed int dmgSource); static void AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3);
--- a/Party.cpp Mon Oct 21 10:07:23 2013 +0600 +++ b/Party.cpp Mon Oct 21 10:07:32 2013 +0600 @@ -99,10 +99,10 @@ uNumDeaths = 0; uNumPrisonTerms = 0; uNumBountiesCollected = 0; - memset(monster_for_hunting_killed.data(), 5, sizeof(__int16)); - memset(monster_id_for_hunting.data(), 5, sizeof(__int16)); - memset(_quest_bits, 64, sizeof(__int8)); - memset(pArcomageWins.data(), 16, sizeof(__int8)); + monster_for_hunting_killed.fill(0); + monster_id_for_hunting.fill(0); + memset(_quest_bits, 0, sizeof(_quest_bits)); + pArcomageWins.fill(0); uNumArenaPageWins = 0; uNumArenaSquireWins = 0; uNumArenaKnightWins = 0; @@ -174,7 +174,7 @@ } if ( playerAlreadyPicked[0] && playerAlreadyPicked[1] && playerAlreadyPicked[2] && playerAlreadyPicked[3] ) - memset(playerAlreadyPicked.data(), 0, 4u); + playerAlreadyPicked.fill(false); for (int i = 0; i < 4; i++) { v6 = &this->pPlayers[i]; @@ -293,7 +293,7 @@ pHireling1Name[0] = 0; pHireling2Name[0] = 0; this->hirelingScrollPosition = 0; - memset(pHirelings.data(), 0, 2 * sizeof(NPCData)); + memset(&pHirelings, 0, sizeof(pHirelings)); strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); //Zoltan this->pPlayers[0].uPrevFace = 17; @@ -552,9 +552,9 @@ pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; // default character ui - stats uFlags = 0; - memset(_autonote_bits, 0, 26); - memset(_quest_bits, 0, 64); - memset(pIsArtifactFound.data(), 0, 29); + memset(_autonote_bits, 0, sizeof(_autonote_bits)); + memset(_quest_bits, 0, sizeof(_autonote_bits)); + pIsArtifactFound.fill(0); _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_RED_POTION_ACTIVE, 1); _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_SEASHELL_ACTIVE, 1); _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_LONGBOW_ACTIVE, 1); @@ -562,7 +562,7 @@ _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_LUTE_ACTIVE, 1); _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_HAT_ACTIVE, 1); - memset(PartyTimes._shop_ban_times.data(),0,53*sizeof(__int64)); + PartyTimes._shop_ban_times.fill(0); memcpy(pNPCStats->pNewNPCData, pNPCStats->pNPCData, 0x94BCu); memcpy(pNPCStats->pGroups_copy, pNPCStats->pGroups, 0x66u);
--- a/Player.cpp Mon Oct 21 10:07:23 2013 +0600 +++ b/Player.cpp Mon Oct 21 10:07:32 2013 +0600 @@ -750,7 +750,7 @@ case Condition_Zombie: if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead()) return; - memset(&pConditions[0], 0, sizeof(pConditions)); + pConditions.fill(0); sHealth = GetMaxHealth(); sMana = 0; player_sex = 0; @@ -1240,7 +1240,7 @@ Player::Player() { memset(&pEquipment, 0, sizeof(PlayerEquipment)); - memset(pInventoryMatrix.data(), 0, 126 * sizeof(int)); + pInventoryMatrix.fill(0); for (uint i = 0; i < 126; ++i) pInventoryItemList[i].Reset(); for (uint i = 0; i < 12; ++i) @@ -1260,7 +1260,7 @@ pName[0] = 0; uCurrentFace = 0; uVoiceID = 0; - memset(pConditions.data(), 0, 20 * sizeof(__int64)); + pConditions.fill(0); field_BB = 0; @@ -1327,8 +1327,8 @@ uNumArmageddonCasts = 0; uNumFireSpikeCasts = 0; - memset(field_1988, 0, 49 * sizeof(int)); - memset(playerEventBits, 0, 64 * sizeof(char)); + memset(field_1988, 0, sizeof(field_1988)); + memset(playerEventBits, 0, sizeof(playerEventBits)); field_E0 = 0; field_E4 = 0; @@ -3910,9 +3910,9 @@ uLevel = 1; uExperience = 251 + rand() % 100; uBirthYear = 1147 - rand() % 6; - memset(pActiveSkills.data(), 0, sizeof(pActiveSkills)); - memset(_achieved_awards_bits, 0, 64); - memset(&spellbook, 0, sizeof(PlayerSpells)); + pActiveSkills.fill(0); + memset(_achieved_awards_bits, 0, sizeof(_achieved_awards_bits)); + memset(&spellbook, 0, sizeof(spellbook)); for (uint i = 0; i < 37; ++i) { @@ -4491,7 +4491,7 @@ v30 = playerAffected->pConditions[Condition_Dead]; v32 = playerAffected->pConditions[Condition_Pertified]; v34 = playerAffected->pConditions[Condition_Eradicated]; - memset(&playerAffected->pConditions,0,sizeof(pConditions)); + pConditions.fill(0); playerAffected->pConditions[Condition_Dead] = v30; playerAffected->pConditions[Condition_Pertified] = v32; playerAffected->pConditions[Condition_Eradicated] = v34; @@ -5737,7 +5737,7 @@ PlayAwardSound_Anim(); return; case VAR_MajorCondition: - memset(this, 0, 0xA0u); + pConditions.fill(0); PlayAwardSound_Anim(); return; case VAR_AutoNotes: @@ -6333,7 +6333,7 @@ PlayAwardSound_Anim97(); return; case VAR_MajorCondition : - memset(this, 0, 0xA0u); + pConditions.fill(0); PlayAwardSound_Anim97(); return; case VAR_AutoNotes: @@ -7026,7 +7026,7 @@ } } if ( pParty->pHirelings[0].uProfession == pValue ) - memset(pParty->pHirelings.data(), 0, sizeof(NPCData)); + memset(&pParty->pHirelings[0], 0, sizeof(NPCData)); if ( pParty->pHirelings[1].uProfession == pValue ) memset(&pParty->pHirelings[1], 0, sizeof(NPCData)); pParty->hirelingScrollPosition = 0; @@ -7246,7 +7246,7 @@ //----- (00439FCB) -------------------------------------------------------- -void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int element, Vec3_int_ *pPos, unsigned int a4) +void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int dmgSource, Vec3_int_ *pPos, unsigned int a4) { Player *playerPtr; // ebx@3 Actor *actorPtr; // esi@3 @@ -7297,7 +7297,7 @@ } } pAudioPlayer->PlaySound(soundToPlay, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); - int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, element); + int dmgToReceive = actorPtr->_43B3E0_CalcDamage(dmgSource); if ( actorPtr->pActorBuffs[3].uExpireTime > 0 ) { __int16 spellPower = actorPtr->pActorBuffs[3].uPower; @@ -7305,7 +7305,7 @@ dmgToReceive /= (signed int)spellPower; } int damageType; - switch (element) + switch (dmgSource) { case 0: damageType = actorPtr->pMonsterInfo.uAttack1Type; break; @@ -7437,7 +7437,7 @@ if ( a4 == -1 ) a4 = stru_50C198.which_player_would_attack(actorPtr); Player *playerPtr = &pParty->pPlayers[a4]; - int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, element); + int dmgToReceive = actorPtr->_43B3E0_CalcDamage(dmgSource); unsigned __int16 spriteType = v37->uType; if ( v37->uType == 545 ) { @@ -7492,7 +7492,7 @@ dmgToReceive /= (signed int)spellPower; } int damageType; - switch(element) + switch(dmgSource) { case 0: damageType = actorPtr->pMonsterInfo.uAttack1Type; @@ -7553,7 +7553,7 @@ } } } - if ( !element + if ( !dmgSource && !(dword_6BE368_debug_settings_2 & 0x10) && actorPtr->pMonsterInfo.uSpecialAttackType && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackLevel )
--- a/Player.h Mon Oct 21 10:07:23 2013 +0600 +++ b/Player.h Mon Oct 21 10:07:32 2013 +0600 @@ -220,6 +220,8 @@ CHARACTER_ATTRIBUTE_SKILL_LEARNING = 46 }; +#pragma warning( push ) +#pragma warning( disable: 4341 ) /* 328 */ enum PLAYER_SKILL_TYPE: signed __int8 { @@ -264,6 +266,7 @@ PLAYER_SKILL_MISC = 38, PLAYER_SKILL_INVALID = -1 }; +#pragma warning( pop ) /* 329 */ enum PLAYER_CLASS_TYPE: unsigned __int8
--- a/TileFrameTable.h Mon Oct 21 10:07:23 2013 +0600 +++ b/TileFrameTable.h Mon Oct 21 10:07:32 2013 +0600 @@ -20,7 +20,8 @@ TILE_DESC_SCROLL_RIGHT = 0x2000, }; - +#pragma warning( push ) +#pragma warning( disable: 4341 ) enum Tileset: signed __int16 { Tileset_Grass = 0, @@ -36,6 +37,7 @@ Tileset_RoadGrassCobble = 10, Tileset_NULL =-1 }; +#pragma warning( pop ) /* 48 */ #pragma pack(push, 1)
--- a/mm7_2.cpp Mon Oct 21 10:07:23 2013 +0600 +++ b/mm7_2.cpp Mon Oct 21 10:07:32 2013 +0600 @@ -4128,136 +4128,136 @@ void IntegrityTest() { - assert(sizeof(MovieHeader) == 44); - assert(sizeof(SoundDesc_mm6) == 112); - assert(sizeof(SoundDesc) == 120); - assert(sizeof(OverlayDesc) == 8); - assert(sizeof(ChestDesc) == 36); - assert(sizeof(ObjectDesc_mm6) == 52); - assert(sizeof(ObjectDesc) == 56); - assert(sizeof(DecorationDesc) == 84); - assert(sizeof(IconFrame) == 32); - assert(sizeof(PlayerFrame) == 10); - assert(sizeof(TextureFrame) == 20); - assert(sizeof(SpriteFrame) == 60); - assert(sizeof(RenderVertexSoft) == 0x30); - assert(sizeof(RenderBillboard) == 0x34); - assert(sizeof(Texture) == 0x48); - assert(sizeof(RGBTexture) == 0x28); - assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4); // + virtual dtor ptr - assert(sizeof(AudioPlayer) == 0xC84); - assert(sizeof(SoundDesc) == 0x78); - assert(sizeof(stru339_spell_sound) == 0xAFD8); - assert(sizeof(VideoPlayer) == 0x108 + 4); - assert(sizeof(MovieHeader) == 0x2C); - assert(sizeof(DecorationDesc) == 0x54); - assert(sizeof(ObjectDesc) == 0x38); - assert(sizeof(OverlayDesc) == 0x8); - assert(sizeof(ChestDesc) == 0x24); - assert(sizeof(TileDesc) == 0x1A); - assert(sizeof(MonsterDesc_mm6) == 148); - assert(sizeof(MonsterDesc) == 152); - assert(sizeof(Timer) == 0x28); - assert(sizeof(OtherOverlay) == 0x14); - assert(sizeof(ItemGen) == 0x24); - assert(sizeof(SpriteObject) == 0x70); - assert(sizeof(ItemDesc) == 0x30); - assert(sizeof(ItemsTable) == 0x117A0); - assert(sizeof(Chest) == 0x14CC); - assert(sizeof(MapInfo) == 0x44); - assert(sizeof(SpellInfo) == 0x24); - assert(sizeof(SpellData) == 0x14); - assert(sizeof(SpellBuff) == 0x10); - assert(sizeof(AIDirection) == 0x1C); - assert(sizeof(ActorJob) == 0xC); - assert(sizeof(Actor) == 0x344); - assert(sizeof(LevelDecoration) == 0x20); - assert(sizeof(KeyboardActionMapping) == 0x20C); - assert(sizeof(UIAnimation) == 0xD); - assert(sizeof(SpawnPointMM7) == 0x18); - assert(sizeof(ODMFace) == 0x134); - assert(sizeof(BSPNode) == 0x8); - assert(sizeof(BSPModel) == 0xBC); - assert(sizeof(OutdoorLocation) == 0x1C28C); - assert(sizeof(BLVFace) == 0x60); - assert(sizeof(BLVFaceExtra) == 0x24); - assert(sizeof(BLVSector) == 0x74); - assert(sizeof(BLVLightMM7) == 0x10); - assert(sizeof(BLVDoor) == 0x50); - assert(sizeof(IndoorLocation) == 0x690); - //assert(sizeof(ODMRenderParams) == 0x74); - assert(sizeof(Mouse) == 0x114); - assert(sizeof(Particle_sw) == 0x68); - assert(sizeof(Particle) == 0x68); - assert(sizeof(ParticleEngine) == 0xE430); - assert(sizeof(Lightmap) == 0xC1C); - assert(sizeof(LightmapBuilder) == 0x3CBC38); - assert(sizeof(Vis_SelectionList) == 0x2008); - assert(sizeof(Vis) == 0x20D0); - assert(sizeof(PlayerBuffAnim) == 0x10); - assert(sizeof(ProjectileAnim) == 0x1C); - assert(sizeof(stru6) == 0x5F8); - assert(sizeof(IndoorCameraD3D_Vec3) == 0x10); - assert(sizeof(IndoorCameraD3D_Vec4) == 0x18); //should be 14 (10 vec3 + 4 vdtor) but 18 coz of his +4 from own vdtor, but it is odd since vdtor already present from vec3 - //assert(sizeof(IndoorCameraD3D) == 0x1A1384); - assert(sizeof(StationaryLight) == 0xC); - assert(sizeof(LightsStack_StationaryLight_) == 0x12C8); - assert(sizeof(MobileLight) == 0x12); - assert(sizeof(LightsStack_MobileLight_) == 0x1C28); - assert(sizeof(Game) == 0xE78); - assert(sizeof(stru141_actor_collision_object) == 0xA8); - assert(sizeof(ActionQueue) == 0x7C); - assert(sizeof(NPCData) == 0x4C); - assert(sizeof(NPCStats) == 0x17FFC); - assert(sizeof(BspRenderer) == 0x53740); - assert(sizeof(PaletteManager) == 0x267AF0); - assert(sizeof(ViewingParams) == 0x26C); - //assert(sizeof(IndoorCamera) == 0x50); - assert(sizeof(Bloodsplat) == 0x28); - assert(sizeof(BloodsplatContainer) == 0xA0C); - assert(sizeof(TrailParticle) == 0x18); - assert(sizeof(EventIndex) == 0xC); - assert(sizeof(_2devent) == 0x34); - assert(sizeof(stru176) == 0x20); - assert(sizeof(SavegameHeader) == 0x64); - assert(sizeof(SavegameList) == 0x3138); - assert(sizeof(StorylineText) == 0x160); - assert(sizeof(FactionTable) == 0x1EF1); - assert(sizeof(Decal) == 0xC20); - assert(sizeof(DecalBuilder) == 0x30C038); - assert(sizeof(MonsterInfo) == 0x58); - assert(sizeof(MonsterStats) == 0x5BA0); - assert(sizeof(RenderD3D) == 0x148); -// assert(sizeof(Render) == 0x129844); - assert(sizeof(Player) == 0x1B3C); - assert(sizeof(PartyTimeStruct) == 0x678); - assert(sizeof(Party) == 0x16238); - assert(sizeof(GUIButton) == 0xBC); - assert(sizeof(GUIWindow) == 0x54); - assert(sizeof(GUIProgressBar) == 0x1B8); - assert(sizeof(GUIFont) == 0x1020); - // assert(sizeof(stru262_TurnBased) == 0x40); - assert(sizeof(ArcomageGame) == 0xFB); - assert(sizeof(CastSpellInfo) == 0x14); - assert(sizeof(ArcomageCard) == 0x6C); - assert(sizeof(stru320) == 0x3FC); - assert(sizeof(TravelInfo) == 0x20); - assert(sizeof(stru336) == 0x798); - assert(sizeof(Vec3_short_) == 6); - assert(sizeof(BLVFace) == 96); - assert(sizeof(BLVFaceExtra) == 36); - assert(sizeof(BLVSector) == 116); - assert(sizeof(LevelDecoration) == 32); - assert(sizeof(BLVLightMM7) == 16); - assert(sizeof(BSPNode) == 8); - assert(sizeof(SpawnPointMM7) == 24); - assert(sizeof(DDM_DLV_Header) == 40); - assert(sizeof(Actor) == 836); - assert(sizeof(SpriteObject) == 112); - assert(sizeof(Chest) == 5324); - assert(sizeof(stru123) == 0xC8); - assert(sizeof(BLVMapOutline) == 12); - assert(sizeof(LODSprite) == 0x28); + static_assert(sizeof(MovieHeader) == 44, "Wrong type size"); + static_assert(sizeof(SoundDesc_mm6) == 112, "Wrong type size"); + static_assert(sizeof(SoundDesc) == 120, "Wrong type size"); + static_assert(sizeof(OverlayDesc) == 8, "Wrong type size"); + static_assert(sizeof(ChestDesc) == 36, "Wrong type size"); + static_assert(sizeof(ObjectDesc_mm6) == 52, "Wrong type size"); + static_assert(sizeof(ObjectDesc) == 56, "Wrong type size"); + static_assert(sizeof(DecorationDesc) == 84, "Wrong type size"); + static_assert(sizeof(IconFrame) == 32, "Wrong type size"); + static_assert(sizeof(PlayerFrame) == 10, "Wrong type size"); + static_assert(sizeof(TextureFrame) == 20, "Wrong type size"); + static_assert(sizeof(SpriteFrame) == 60, "Wrong type size"); + static_assert(sizeof(RenderVertexSoft) == 0x30, "Wrong type size"); + static_assert(sizeof(RenderBillboard) == 0x34, "Wrong type size"); + static_assert(sizeof(Texture) == 0x48, "Wrong type size"); + static_assert(sizeof(RGBTexture) == 0x28, "Wrong type size"); + static_assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4, "Wrong type size"); // + virtual dtor ptr + static_assert(sizeof(AudioPlayer) == 0xC84, "Wrong type size"); + static_assert(sizeof(SoundDesc) == 0x78, "Wrong type size"); + static_assert(sizeof(stru339_spell_sound) == 0xAFD8, "Wrong type size"); + static_assert(sizeof(VideoPlayer) == 0x108 + 4, "Wrong type size"); + static_assert(sizeof(MovieHeader) == 0x2C, "Wrong type size"); + static_assert(sizeof(DecorationDesc) == 0x54, "Wrong type size"); + static_assert(sizeof(ObjectDesc) == 0x38, "Wrong type size"); + static_assert(sizeof(OverlayDesc) == 0x8, "Wrong type size"); + static_assert(sizeof(ChestDesc) == 0x24, "Wrong type size"); + static_assert(sizeof(TileDesc) == 0x1A, "Wrong type size"); + static_assert(sizeof(MonsterDesc_mm6) == 148, "Wrong type size"); + static_assert(sizeof(MonsterDesc) == 152, "Wrong type size"); + static_assert(sizeof(Timer) == 0x28, "Wrong type size"); + static_assert(sizeof(OtherOverlay) == 0x14, "Wrong type size"); + static_assert(sizeof(ItemGen) == 0x24, "Wrong type size"); + static_assert(sizeof(SpriteObject) == 0x70, "Wrong type size"); + static_assert(sizeof(ItemDesc) == 0x30, "Wrong type size"); + static_assert(sizeof(ItemsTable) == 0x117A0, "Wrong type size"); + static_assert(sizeof(Chest) == 0x14CC, "Wrong type size"); + static_assert(sizeof(MapInfo) == 0x44, "Wrong type size"); + static_assert(sizeof(SpellInfo) == 0x24, "Wrong type size"); + static_assert(sizeof(SpellData) == 0x14, "Wrong type size"); + static_assert(sizeof(SpellBuff) == 0x10, "Wrong type size"); + static_assert(sizeof(AIDirection) == 0x1C, "Wrong type size"); + static_assert(sizeof(ActorJob) == 0xC, "Wrong type size"); + static_assert(sizeof(Actor) == 0x344, "Wrong type size"); + static_assert(sizeof(LevelDecoration) == 0x20, "Wrong type size"); + static_assert(sizeof(KeyboardActionMapping) == 0x20C, "Wrong type size"); + static_assert(sizeof(UIAnimation) == 0xD, "Wrong type size"); + static_assert(sizeof(SpawnPointMM7) == 0x18, "Wrong type size"); + static_assert(sizeof(ODMFace) == 0x134, "Wrong type size"); + static_assert(sizeof(BSPNode) == 0x8, "Wrong type size"); + static_assert(sizeof(BSPModel) == 0xBC, "Wrong type size"); + static_assert(sizeof(OutdoorLocation) == 0x1C28C, "Wrong type size"); + static_assert(sizeof(BLVFace) == 0x60, "Wrong type size"); + static_assert(sizeof(BLVFaceExtra) == 0x24, "Wrong type size"); + static_assert(sizeof(BLVSector) == 0x74, "Wrong type size"); + static_assert(sizeof(BLVLightMM7) == 0x10, "Wrong type size"); + static_assert(sizeof(BLVDoor) == 0x50, "Wrong type size"); + static_assert(sizeof(IndoorLocation) == 0x690, "Wrong type size"); + //static_assert(sizeof(ODMRenderParams) == 0x74, "Wrong type size"); + static_assert(sizeof(Mouse) == 0x114, "Wrong type size"); + static_assert(sizeof(Particle_sw) == 0x68, "Wrong type size"); + static_assert(sizeof(Particle) == 0x68, "Wrong type size"); + static_assert(sizeof(ParticleEngine) == 0xE430, "Wrong type size"); + static_assert(sizeof(Lightmap) == 0xC1C, "Wrong type size"); + static_assert(sizeof(LightmapBuilder) == 0x3CBC38, "Wrong type size"); + static_assert(sizeof(Vis_SelectionList) == 0x2008, "Wrong type size"); + static_assert(sizeof(Vis) == 0x20D0, "Wrong type size"); + static_assert(sizeof(PlayerBuffAnim) == 0x10, "Wrong type size"); + static_assert(sizeof(ProjectileAnim) == 0x1C, "Wrong type size"); + static_assert(sizeof(stru6) == 0x5F8, "Wrong type size"); + static_assert(sizeof(IndoorCameraD3D_Vec3) == 0x10, "Wrong type size"); + static_assert(sizeof(IndoorCameraD3D_Vec4) == 0x18, "Wrong type size"); //should be 14 (10 vec3 + 4 vdtor) but 18 coz of his +4 from own vdtor, but it is odd since vdtor already present from vec3 + //static_assert(sizeof(IndoorCameraD3D) == 0x1A1384, "Wrong type size"); + static_assert(sizeof(StationaryLight) == 0xC, "Wrong type size"); + static_assert(sizeof(LightsStack_StationaryLight_) == 0x12C8, "Wrong type size"); + static_assert(sizeof(MobileLight) == 0x12, "Wrong type size"); + static_assert(sizeof(LightsStack_MobileLight_) == 0x1C28, "Wrong type size"); + static_assert(sizeof(Game) == 0xE78, "Wrong type size"); + static_assert(sizeof(stru141_actor_collision_object) == 0xA8, "Wrong type size"); + static_assert(sizeof(ActionQueue) == 0x7C, "Wrong type size"); + static_assert(sizeof(NPCData) == 0x4C, "Wrong type size"); + static_assert(sizeof(NPCStats) == 0x17FFC, "Wrong type size"); + static_assert(sizeof(BspRenderer) == 0x53740, "Wrong type size"); + static_assert(sizeof(PaletteManager) == 0x267AF0, "Wrong type size"); + static_assert(sizeof(ViewingParams) == 0x26C, "Wrong type size"); + //static_assert(sizeof(IndoorCamera) == 0x50, "Wrong type size"); + static_assert(sizeof(Bloodsplat) == 0x28, "Wrong type size"); + static_assert(sizeof(BloodsplatContainer) == 0xA0C, "Wrong type size"); + static_assert(sizeof(TrailParticle) == 0x18, "Wrong type size"); + static_assert(sizeof(EventIndex) == 0xC, "Wrong type size"); + static_assert(sizeof(_2devent) == 0x34, "Wrong type size"); + static_assert(sizeof(stru176) == 0x20, "Wrong type size"); + static_assert(sizeof(SavegameHeader) == 0x64, "Wrong type size"); + static_assert(sizeof(SavegameList) == 0x3138, "Wrong type size"); + static_assert(sizeof(StorylineText) == 0x160, "Wrong type size"); + static_assert(sizeof(FactionTable) == 0x1EF1, "Wrong type size"); + static_assert(sizeof(Decal) == 0xC20, "Wrong type size"); + static_assert(sizeof(DecalBuilder) == 0x30C038, "Wrong type size"); + static_assert(sizeof(MonsterInfo) == 0x58, "Wrong type size"); + static_assert(sizeof(MonsterStats) == 0x5BA0, "Wrong type size"); + static_assert(sizeof(RenderD3D) == 0x148, "Wrong type size"); + // static_assert(sizeof(Render) == 0x129844, "Wrong type size"); + static_assert(sizeof(Player) == 0x1B3C, "Wrong type size"); + static_assert(sizeof(PartyTimeStruct) == 0x678, "Wrong type size"); + static_assert(sizeof(Party) == 0x16238, "Wrong type size"); + static_assert(sizeof(GUIButton) == 0xBC, "Wrong type size"); + static_assert(sizeof(GUIWindow) == 0x54, "Wrong type size"); + static_assert(sizeof(GUIProgressBar) == 0x1B8, "Wrong type size"); + static_assert(sizeof(GUIFont) == 0x1020, "Wrong type size"); + // static_assert(sizeof(stru262_TurnBased) == 0x40, "Wrong type size"); + static_assert(sizeof(ArcomageGame) == 0xFB, "Wrong type size"); + static_assert(sizeof(CastSpellInfo) == 0x14, "Wrong type size"); + static_assert(sizeof(ArcomageCard) == 0x6C, "Wrong type size"); + static_assert(sizeof(stru320) == 0x3FC, "Wrong type size"); + static_assert(sizeof(TravelInfo) == 0x20, "Wrong type size"); + static_assert(sizeof(stru336) == 0x798, "Wrong type size"); + static_assert(sizeof(Vec3_short_) == 6, "Wrong type size"); + static_assert(sizeof(BLVFace) == 96, "Wrong type size"); + static_assert(sizeof(BLVFaceExtra) == 36, "Wrong type size"); + static_assert(sizeof(BLVSector) == 116, "Wrong type size"); + static_assert(sizeof(LevelDecoration) == 32, "Wrong type size"); + static_assert(sizeof(BLVLightMM7) == 16, "Wrong type size"); + static_assert(sizeof(BSPNode) == 8, "Wrong type size"); + static_assert(sizeof(SpawnPointMM7) == 24, "Wrong type size"); + static_assert(sizeof(DDM_DLV_Header) == 40, "Wrong type size"); + static_assert(sizeof(Actor) == 836, "Wrong type size"); + static_assert(sizeof(SpriteObject) == 112, "Wrong type size"); + static_assert(sizeof(Chest) == 5324, "Wrong type size"); + static_assert(sizeof(stru123) == 0xC8, "Wrong type size"); + static_assert(sizeof(BLVMapOutline) == 12, "Wrong type size"); + static_assert(sizeof(LODSprite) == 0x28, "Wrong type size"); } bool new_sky = false;
--- a/mm7_5.cpp Mon Oct 21 10:07:23 2013 +0600 +++ b/mm7_5.cpp Mon Oct 21 10:07:32 2013 +0600 @@ -3983,7 +3983,7 @@ v6 = stru_50C198._4273BB(v8, v7, v4, 0); if ( v6 ) { - v10 = (unsigned int)Actor::_43B3E0_CalcDamage(v8, a4); + v10 = (unsigned int)v8->_43B3E0_CalcDamage(a4); if ( (signed __int64)v8->pActorBuffs[3].uExpireTime > 0 ) { v11 = v8->pActorBuffs[3].uPower;