Mercurial > mm7
changeset 1933:5fcf6023f9c3
DamageMonsterFromParty some additional vars removed, changed the ordering part to something more readable
author | Grumpy7 |
---|---|
date | Wed, 23 Oct 2013 21:13:28 -0700 |
parents | 28b8ecb5dac6 |
children | 564898c5882b |
files | Actor.cpp Items.cpp |
diffstat | 2 files changed, 31 insertions(+), 80 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Wed Oct 23 21:10:11 2013 -0700 +++ b/Actor.cpp Wed Oct 23 21:13:28 2013 -0700 @@ -3612,7 +3612,7 @@ float v39; // ST00_4@104 int v40; // ebx@107 unsigned int v41; // ebx@109 - signed __int64 v42; // qax@125 + signed __int64 extraRecoveryTime; // qax@125 unsigned __int16 v43; // ax@132 char v44; // bl@132 unsigned __int16 v45; // ax@132 @@ -3711,32 +3711,13 @@ v61 = projectileSprite->field_60_distance_related_prolly_lod; if ( projectileSprite->spell_id != SPELL_DARK_SOULDRINKER ) { - v50 = pParty->vPosition.x - projectileSprite->vPosition.x; - pMonsterName = (char *)(pParty->vPosition.y - projectileSprite->vPosition.y); - pPlayerName = (char *)(pParty->vPosition.z - projectileSprite->vPosition.z); - v52 = abs((int)pPlayerName); - v61 = abs(v50); - v10 = abs(v50); - v11 = (int)abs((int)pMonsterName); - v12 = v52; - if ( v10 < v11) - { - v10 = (int)v11; - v11 = v10; - } - if ( v10 < v12 ) - { - v13 = v10; - v10 = v12; - v12 = v13; - } - if ( v11 < (signed int)v12 ) - { - v14 = v12; - v12 = v11; - v11 = v14; - } - v61 = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; + std::array<int, 3> distances; + distances[0] = abs(pParty->vPosition.x - projectileSprite->vPosition.x); + distances[1] = abs(pParty->vPosition.y - projectileSprite->vPosition.y); + distances[2] = abs(pParty->vPosition.z - projectileSprite->vPosition.z); + std::sort(distances.begin(), distances.end()); + v61 = ((unsigned int)(11 * distances[1]) >> 5) + (distances[0] >> 2) + distances[2]; + if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) { return; @@ -3754,10 +3735,10 @@ switch (projectileSprite->spell_id) { case SPELL_LASER_PROJECTILE: - v16 = player->pActiveSkills[7]; + v16 = player->pActiveSkills[PLAYER_SKILL_BLASTER]; v61 = 1; if ( (signed int)SkillToMastery(v16) >= 3 ) - a4 = player->pActiveSkills[7] & 0x3F; + a4 = player->pActiveSkills[PLAYER_SKILL_BLASTER] & 0x3F; attackElement = DMGT_PHISYCAL; uDamageAmount = player->CalculateMeleeDamageTo(true, true, 0); if ( !stru_50C198.PlayerHitOrMiss(player, pMonster, v61, a4) ) @@ -3802,9 +3783,8 @@ } break; case SPELL_BOW_ARROW: - v50 = pMonster->word_000086_some_monster_id; attackElement = DMGT_PHISYCAL; - uDamageAmount = player->CalculateRangedDamageTo(v50); + uDamageAmount = player->CalculateRangedDamageTo(pMonster->word_000086_some_monster_id); if ( pMonster->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime > 0 ) uDamageAmount /= 2; IsAdditionalDamagePossible = true; @@ -3834,8 +3814,7 @@ v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, attackElement, uDamageAmount); if ( !projectileSprite && player->IsUnarmed() && player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime > 0 ) { - v50 = player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uPower; - v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, v50); + v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uPower); v61 += v29; } uDamageAmount = v61; @@ -3849,7 +3828,6 @@ player->sHealth += v61 / 5; if ( player->sHealth > player->GetMaxHealth() ) player->sHealth = player->GetMaxHealth(); - v62 = 0; } v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, attackElement, a4); uDamageAmount += v30; @@ -3871,17 +3849,14 @@ player->sHealth += v61 / 5; if ( player->sHealth > player->GetMaxHealth() ) player->sHealth = player->GetMaxHealth(); - v62 = 0; } - v31 = stru_50C198.CalcMagicalDamageToActor(pMonster, attackElement, a4); - uDamageAmount += v31; + uDamageAmount += stru_50C198.CalcMagicalDamageToActor(pMonster, attackElement, a4); } } } } - v32 = uDamageAmount; pMonster->sCurrentHP -= uDamageAmount; - if ( !v32 && !hit_will_stun ) + if ( uDamageAmount == 0 && !hit_will_stun ) { player->PlaySound(SPEECH_52, 0); return; @@ -3904,28 +3879,10 @@ { if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 ) { - v33 = byte_4D864C && pGame->uFlags & 80000 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; - //v55 = v33; - if ( pRenderer->pRenderD3D ) + if ( pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) { - if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) - { - pMonsterName = 0; - v34 = pMonster->vPosition.z; - *(float *)&pPlayerName = (double)v33; - //v51 = (unsigned __int64 *)v34; - *(float *)&v47 = 0.0; - v35 = pMonster->vPosition.y; - *((float *)&v46 + 1) = 0.0; - *(float *)&v46 = 1.0; - v36 = (double)(signed int)pMonster->vPosition.z; - //v51 = (unsigned __int64 *)v35; - v37 = v36; - //v51 = (unsigned __int64 *)pMonster->vPosition.x; - v38 = (double)v35; - v39 = (double)(signed int)pMonster->vPosition.x; - pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0); - } + v33 = byte_4D864C && pGame->uFlags & 80000 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; + pDecalBuilder->AddBloodsplat(pMonster->vPosition.x, pMonster->vPosition.y, pMonster->vPosition.z, 1.0, 0.0, 0.0, v33, 0, 0); } } Actor::Die(uActorID_Monster_); @@ -3949,14 +3906,13 @@ && uDamageAmount != 0 ) player->ReceiveDamage(uDamageAmount, attackElement); int knockbackValue = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; - if ( (player->GetSpecialItemBonus(24) || hit_will_stun) - && stru_50C198.GetMagicalResistance(pMonster, DMGT_EARTH) ) + if ( (player->GetSpecialItemBonus(24) || hit_will_stun) && stru_50C198.GetMagicalResistance(pMonster, DMGT_EARTH) ) { - v42 = 20; + extraRecoveryTime = 20; knockbackValue = 10; if ( !pParty->bTurnBasedModeOn ) - v42 = (signed __int64)(flt_6BE3A8_debug_recmod2 * 42.66666666666666); - pMonster->pMonsterInfo.uRecoveryTime += v42; + extraRecoveryTime = (signed __int64)(flt_6BE3A8_debug_recmod2 * 42.66666666666666); + pMonster->pMonsterInfo.uRecoveryTime += extraRecoveryTime; if ( bShowDamage ) { pMonsterName = player->pName; // "%s stuns %s" @@ -3964,23 +3920,17 @@ ShowStatusBarString(pTmpBuf.data(), 2u); } } - if ( hit_will_paralyze ) + if ( hit_will_paralyze && pMonster->CanAct() && stru_50C198.GetMagicalResistance(pMonster, DMGT_EARTH)) { - if ( pMonster->CanAct() ) + v43 = player->GetActualSkillLevel(PLAYER_SKILL_MACE); + v45 = SkillToMastery(v43); + v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(7680 * (v43 & 0x3F)) * 0.033333335); + pMonster->pActorBuffs[ACTOR_BUFF_PARALYZED].Apply(v46, v45, 0, 0, 0); + if ( bShowDamage ) { - if ( stru_50C198.GetMagicalResistance(pMonster, DMGT_EARTH) ) - { - LOBYTE(v43) = player->GetActualSkillLevel(PLAYER_SKILL_MACE); - v45 = SkillToMastery(v43); - v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(7680 * (v43 & 0x3F)) * 0.033333335); - pMonster->pActorBuffs[6].Apply(v46, v45, 0, 0, 0); - if ( bShowDamage ) - { - pMonsterName = player->pName; // "%s paralyzes %s" - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[636], player->pName, pMonster); - ShowStatusBarString(pTmpBuf.data(), 2u); - } - } + pMonsterName = player->pName; // "%s paralyzes %s" + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[636], player->pName, pMonster); + ShowStatusBarString(pTmpBuf.data(), 2u); } } if ( knockbackValue > 10 )
--- a/Items.cpp Wed Oct 23 21:10:11 2013 -0700 +++ b/Items.cpp Wed Oct 23 21:13:28 2013 -0700 @@ -154,6 +154,7 @@ //----- (00439DF3) -------------------------------------------------------- int ItemGen::_439DF3_get_additional_damage(int *damage_type, bool *draintargetHP) { + *draintargetHP = false; *damage_type = 0; if ( !uItemID ) return 0;