Mercurial > mm7
diff Player.cpp @ 1657:51a74615d956
DamagePlayerFromMonster continuing cleanup, part 3
author | Grumpy7 |
---|---|
date | Wed, 18 Sep 2013 10:22:16 +0200 |
parents | 56847118d50c |
children | 406872881eb6 |
line wrap: on
line diff
--- a/Player.cpp Wed Sep 18 09:06:28 2013 +0200 +++ b/Player.cpp Wed Sep 18 10:22:16 2013 +0200 @@ -7474,18 +7474,9 @@ Player *playerPtr; // ebx@3 Actor *actorPtr; // esi@3 unsigned int v8; // eax@4 - char *v9; // eax@5 - signed int v10; // eax@6 int v11; // edx@8 - int v12; // edx@9 - int v13; // edx@10 int v14; // edx@16 - int v15; // edx@17 - int v16; // edx@18 enum SoundID v17; // eax@24 - int v18; // eax@26 - unsigned __int8 v19; // zf@26 - unsigned __int8 v20; // sf@26 unsigned __int16 v21; // ax@29 signed int v22; // edi@36 int v23; // eax@38 @@ -7493,58 +7484,38 @@ AIState v25; // cx@47 signed int v26; // eax@49 int v27; // eax@54 - float v28; // ST18_4@58 - double v29; // st7@58 - float v30; // ST08_4@58 - double v31; // st7@58 - float v32; // ST04_4@58 - float v33; // ST00_4@58 int v34; // edi@61 int v35; // eax@70 - double v36; // st7@70 + int v36; // st7@70 SpriteObject *v37; // ebx@77 int v38; // edi@77 int v39; // esi@77 int v40; // eax@77 int v41; // eax@77 - int v42; // eax@78 Player *v43; // eax@81 //Actor *actorPtr; // esi@82 Player *v45; // edi@84 unsigned __int16 v46; // ax@84 - int v47; // ebx@105 int v48; // eax@107 unsigned __int16 v49; // ax@116 int v50; // ebx@123 unsigned __int16 v51; // ax@124 - char v52; // bl@124 int v53; // eax@128 signed int v54; // eax@134 unsigned __int16 v55; // cx@137 signed int recvdMagicDmg; // eax@139 int v57; // eax@144 - float v58; // ST18_4@148 - double v59; // st7@148 - float v60; // ST08_4@148 - double v61; // st7@148 - float v62; // ST04_4@148 - float v63; // ST00_4@148 int v64; // ebx@151 int v65; // eax@161 - double v66; // st7@161 - signed int v67; // ecx@164 + int v66; // st7@161 signed int v68; // eax@170 int v69; // ecx@170 int v70; // eax@171 - enum SoundID v71; // [sp+20h] [bp-34h]@12 int v72[4]; // [sp+30h] [bp-24h]@164 - double v73; // [sp+40h] [bp-14h]@72 signed int v74; // [sp+44h] [bp-10h]@1 int healthBeforeRecvdDamage; // [sp+48h] [bp-Ch]@3 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 int dmgToReceive; // [sp+50h] [bp-4h]@26 - signed int a4a; // [sp+60h] [bp+Ch]@162 - Player *a4b; // [sp+60h] [bp+Ch]@168 v4 = PID_ID(uObjID); v5 = PID_TYPE(uObjID) - 2; @@ -7634,7 +7605,7 @@ if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS) { v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius; - pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, v27, 0, 0); + pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)v27, 0, 0); } Actor::Die(uActorID); Actor::ApplyFineForKillingPeasant(uActorID); @@ -7659,10 +7630,10 @@ if ( !pParty->bTurnBasedModeOn ) { v35 = playerPtr->GetActualEndurance(); - v36 = (20 - playerPtr->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; + v36 = (int)((20 - playerPtr->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333); playerPtr->SetRecoveryTime(v36); } - int yellThreshold = playerPtr->GetMaxHealth() * 0.25; + int yellThreshold = playerPtr->GetMaxHealth() / 4; if ( yellThreshold < playerPtr->sHealth && yellThreshold >= healthBeforeRecvdDamage && playerPtr->sHealth > 0 ) { playerPtr->PlaySound(SPEECH_48, 0); @@ -7678,10 +7649,46 @@ v40 = PID_TYPE(v37->spell_caster_pid); uActorID = PID_ID(v37->spell_caster_pid); v41 = v40 - 2; - if ( !v41 ) - goto LABEL_80; - v42 = v41 - 1; - if ( !v42 ) + if ( v40 == 2 ) + { + if ( a4 != -1 ) + { + v43 = &pParty->pPlayers[a4]; + } + else + { + v74 = 0; + for (int i = 1; i <= 4; i++) + { + v72[v74] = i; + v74++; + } + if ( v74 ) + { + v43 = &pParty->pPlayers[v72[rand() % v74]];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; + } + } + if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) + { + v70 = v43->GetMaxHealth(); + v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); + v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); + } + else + { + v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); + v69 = 0; + } + v43->ReceiveDamage(v68, (DAMAGE_TYPE)v69); + if ( v38 == OBJECT_Player && !qword_A750D8 ) + { + qword_A750D8 = 256i64; + PlayerSpeechID = SPEECH_44; + uSpeakingCharacter = uActorID + 1; + } + return; + } + else if ( v40 == 3 ) { actorPtr = &pActors[v39]; if ( a4 == -1 ) @@ -7700,51 +7707,48 @@ return; } } - else + else if ( v46 == 555 + || v46 == 510 + || v46 == 500 + || v46 == 515 + || v46 == 505 + || v46 == 530 + || v46 == 525 + || v46 == 520 + || v46 == 535 + || v46 == 540 ) { - if ( v46 != 555 - && v46 != 510 - && v46 != 500 - && v46 != 515 - && v46 != 505 - && v46 != 530 - && v46 != 525 - && v46 != 520 - && v46 != 535 - && v46 != 540 ) - goto LABEL_115; + if ( !stru_50C198.ActorHitOrMiss(actorPtr, v45) ) + return; + if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) + dmgToReceive >>= 1; + if ( v45->HasEnchantedItemEquipped(36) ) + dmgToReceive >>= 1; + if ( v45->HasEnchantedItemEquipped(69) ) + dmgToReceive >>= 1; + if ( v45->HasItemEquipped(EQUIP_ARMOUR) + && v45->pInventoryItemList[v45->pEquipment.uArmor-1].uItemID == ITEM_ARTIFACT_GOVERNORS_ARMOR ) + dmgToReceive >>= 1; + if ( v45->HasItemEquipped(EQUIP_MAIN_HAND)) + { + v48 = v45->pInventoryItemList[v45->pEquipment.uMainHand - 1].uItemID; + if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) + dmgToReceive >>= 1; + } + if ( v45->HasItemEquipped(EQUIP_OFF_HAND)) + { + v48 = v45->pInventoryItemList[v45->pEquipment.uShield - 1].uItemID; + if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) + dmgToReceive >>= 1; + } } - if ( !stru_50C198.ActorHitOrMiss(actorPtr, v45) ) - return; - if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) - dmgToReceive >>= 1; - if ( v45->HasEnchantedItemEquipped(36) ) - dmgToReceive >>= 1; - if ( v45->HasEnchantedItemEquipped(69) ) - dmgToReceive >>= 1; - if ( v45->HasItemEquipped(EQUIP_ARMOUR) - && v45->pInventoryItemList[v45->pEquipment.uArmor-1].uItemID == ITEM_ARTIFACT_GOVERNORS_ARMOR ) - dmgToReceive >>= 1; - if ( v45->HasItemEquipped(EQUIP_MAIN_HAND)) - { - v48 = v45->pInventoryItemList[v45->pEquipment.uMainHand - 1].uItemID; - if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) - dmgToReceive >>= 1; - } - if ( v45->HasItemEquipped(EQUIP_OFF_HAND)) - { - v48 = v45->pInventoryItemList[v45->pEquipment.uShield - 1].uItemID; - if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) - dmgToReceive >>= 1; - } - LABEL_115: if ( actorPtr->pActorBuffs[3].uExpireTime > 0 ) { v49 = actorPtr->pActorBuffs[3].uPower; if ( v49 ) dmgToReceive /= (signed int)v49; } - switch(v47) + switch(v74) { case 0: v50 = actorPtr->pMonsterInfo.uAttack1Type; @@ -7789,7 +7793,7 @@ if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) { v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius; - pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, v57, 0, 0); + pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)v57, 0, 0); } Actor::Die(uActorID); Actor::ApplyFineForKillingPeasant(uActorID); @@ -7809,56 +7813,21 @@ && !(dword_6BE368_debug_settings_2 & 0x10) && actorPtr->pMonsterInfo.uSpecialAttack && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackType ) + { v45->_48DCF6(actorPtr->pMonsterInfo.uSpecialAttack, actorPtr); + } if ( !pParty->bTurnBasedModeOn ) { v65 = v45->GetActualEndurance(); - v66 = (double)(20 - v45->GetParameterBonus(v65)) + v66 = (int)((20 - v45->GetParameterBonus(v65)) * flt_6BE3A4_debug_recmod1 - * 2.133333333333333; - v45->SetRecoveryTime((signed __int64)v66); + * 2.133333333333333); + v45->SetRecoveryTime(v66); } return; } - if ( v42 != 1 ) - return; - LABEL_80: - if ( a4 != -1 ) - { - v43 = &pParty->pPlayers[a4]; - } else { - v74 = 0; - for (int i = 1; i <= 4; i++) - { - v72[v74] = i; - v74++; - } - if ( v74 ) - { - v43 = &pParty->pPlayers[v72[rand() % v74]];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; - } - } - a4b = v43; - if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) - { - v70 = v43->GetMaxHealth(); - v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); - v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); - } - else - { - v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); - v69 = 0; - } - a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); - if ( v38 == OBJECT_Player && !qword_A750D8 ) - { - qword_A750D8 = 256i64; - PlayerSpeechID = SPEECH_44; - uSpeakingCharacter = uActorID + 1; - } return; } }