Mercurial > mm7
diff Actor.cpp @ 1934:564898c5882b
DamageMonsterFromParty cleanup finished
author | Grumpy7 |
---|---|
date | Wed, 23 Oct 2013 21:21:48 -0700 |
parents | 5fcf6023f9c3 |
children | 1cbfb6e50e48 |
line wrap: on
line diff
--- a/Actor.cpp Wed Oct 23 21:13:28 2013 -0700 +++ b/Actor.cpp Wed Oct 23 21:21:48 2013 -0700 @@ -3573,79 +3573,30 @@ //----- (00439474) -------------------------------------------------------- void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) { - //signed int v3; // eax@1 SpriteObject *projectileSprite; // ebx@1 - //int v5; // edx@3 - //bool uPlayerID; // eax@3 - //Player *pPlayer; // edi@4 Actor *pMonster; // esi@7 - //SpriteObject *v9; // ebx@12 - int v10; // eax@12 - int v11; // ebx@12 - unsigned int v12; // ecx@12 - int v13; // edx@15 - int v14; // edx@17 - int v15; // eax@24 unsigned __int16 v16; // cx@25 - int v17; // eax@29 - int v18; // eax@38 - unsigned __int8 v19; // zf@38 - unsigned __int8 v20; // sf@38 - int v21; // edx@44 - int v22; // eax@44 - unsigned __int8 v23; // zf@44 - unsigned __int8 v24; // sf@44 - int v25; // edx@51 - int v26; // ecx@51 - //signed int v27; // eax@51 - //int v28; // eax@53 - signed int v29; // eax@76 - signed int v30; // eax@84 - signed int v31; // eax@92 - int v32; // eax@94 int v33; // eax@100 - int v34; // eax@104 - signed int v35; // eax@104 - double v36; // st7@104 - float v37; // ST08_4@104 - float v38; // ST04_4@104 - float v39; // ST00_4@104 int v40; // ebx@107 - unsigned int v41; // ebx@109 signed __int64 extraRecoveryTime; // qax@125 unsigned __int16 v43; // ax@132 - char v44; // bl@132 unsigned __int16 v45; // ax@132 unsigned __int64 v46; // [sp+Ch] [bp-60h]@6 - const char *v47; // [sp+14h] [bp-58h]@104 char *pPlayerName; // [sp+18h] [bp-54h]@12 char *pMonsterName; // [sp+1Ch] [bp-50h]@6 - int v50; // [sp+20h] [bp-4Ch]@6 - //unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6 - int v52; // [sp+34h] [bp-38h]@12 - //int v53; // [sp+38h] [bp-34h]@10 - //int v54; // [sp+3Ch] [bp-30h]@1 - //int v55; // [sp+40h] [bp-2Ch]@12 signed int a4; // [sp+44h] [bp-28h]@1 - PlayerEquipment *v57; // [sp+48h] [bp-24h]@10 - //int v58; // [sp+4Ch] [bp-20h]@10 bool IsAdditionalDamagePossible; // [sp+50h] [bp-1Ch]@1 - unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1 int v61; // [sp+58h] [bp-14h]@1 - bool v62; // [sp+5Ch] [bp-10h]@1 + bool isLifeStealing; // [sp+5Ch] [bp-10h]@1 int uDamageAmount; // [sp+60h] [bp-Ch]@1 DAMAGE_TYPE attackElement; // [sp+64h] [bp-8h]@27 - int a3; // [sp+6Bh] [bp-1h]@6 - //v3 = a1; projectileSprite = 0; - uActorID_Monster_ = uActorID_Monster; - //v54 = a1; uDamageAmount = 0; a4 = 0; v61 = 0; IsAdditionalDamagePossible = false; - v62 = 0; + isLifeStealing = 0; if ( PID_TYPE(a1) == OBJECT_Item) { projectileSprite = &pSpriteObjects[PID_ID(a1)]; @@ -3657,7 +3608,7 @@ assert(PID_ID(abs(a1)) < 4); Player* player = &pParty->pPlayers[PID_ID(a1)]; - pMonster = &pActors[uActorID_Monster_]; + pMonster = &pActors[uActorID_Monster]; if (pMonster->IsNotAlive()) return; @@ -3814,23 +3765,21 @@ v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, attackElement, uDamageAmount); if ( !projectileSprite && player->IsUnarmed() && player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime > 0 ) { - v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uPower); - v61 += v29; + v61 += stru_50C198.CalcMagicalDamageToActor(pMonster, 8, player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uPower); } uDamageAmount = v61; if ( IsAdditionalDamagePossible ) { if ( projectileSprite ) { - a4 = projectileSprite->stru_24._439DF3_get_additional_damage((int*)&attackElement, &v62); - if ( v62 && pMonster->sCurrentHP > 0 ) + a4 = projectileSprite->stru_24._439DF3_get_additional_damage((int*)&attackElement, &isLifeStealing); + if ( isLifeStealing && pMonster->sCurrentHP > 0 ) { player->sHealth += v61 / 5; if ( player->sHealth > player->GetMaxHealth() ) player->sHealth = player->GetMaxHealth(); } - v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, attackElement, a4); - uDamageAmount += v30; + uDamageAmount += stru_50C198.CalcMagicalDamageToActor(pMonster, attackElement, a4); } else { @@ -3843,8 +3792,8 @@ item = player->GetMainHandItem(); else item = player->GetOffHandItem(); - a4 = item->_439DF3_get_additional_damage((int*)&attackElement, &v62); - if ( v62 && pMonster->sCurrentHP > 0 ) + a4 = item->_439DF3_get_additional_damage((int*)&attackElement, &isLifeStealing); + if ( isLifeStealing && pMonster->sCurrentHP > 0 ) { player->sHealth += v61 / 5; if ( player->sHealth > player->GetMaxHealth() ) @@ -3863,15 +3812,14 @@ } if ( pMonster->sCurrentHP > 0 ) { - Actor::AI_Stun(uActorID_Monster_, a1, 0); - Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); + Actor::AI_Stun(uActorID_Monster, a1, 0); + Actor::AggroSurroundingPeasants(uActorID_Monster, 1); if ( bShowDamage ) { if ( projectileSprite ) - v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points" + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[189], player->pName, pMonster->pActorName, uDamageAmount);// "%s shoots %s for %lu points" else - v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage" - sprintfex(pTmpBuf.data(), v47, player->pName, pMonster->pActorName, uDamageAmount); + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[164], player->pName, pMonster->pActorName, uDamageAmount);// "%s hits %s for %lu damage" ShowStatusBarString(pTmpBuf.data(), 2u); } } @@ -3885,9 +3833,9 @@ pDecalBuilder->AddBloodsplat(pMonster->vPosition.x, pMonster->vPosition.y, pMonster->vPosition.z, 1.0, 0.0, 0.0, v33, 0, 0); } } - Actor::Die(uActorID_Monster_); - Actor::ApplyFineForKillingPeasant(uActorID_Monster_); - Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); + Actor::Die(uActorID_Monster); + Actor::ApplyFineForKillingPeasant(uActorID_Monster); + Actor::AggroSurroundingPeasants(uActorID_Monster, 1); if ( pMonster->pMonsterInfo.uExp ) pParty->GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp); v40 = SPEECH_51; @@ -3944,7 +3892,7 @@ pMonster->vVelocity.y = 50 * LOWORD(pVelocity->y); pMonster->vVelocity.z = 50 * LOWORD(pVelocity->z); } - Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster_, 1, v61); + Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster, 1, v61); } //----- (004BBF61) -------------------------------------------------------- void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z)