Mercurial > mm7
changeset 1649:d25389b91029
DamagePlayerFromMonster continuing cleanup
author | Grumpy7 |
---|---|
date | Wed, 18 Sep 2013 06:30:53 +0200 |
parents | a4390cef284c |
children | b0a2b8525483 |
files | Player.cpp |
diffstat | 1 files changed, 52 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/Player.cpp Tue Sep 17 07:30:41 2013 +0200 +++ b/Player.cpp Wed Sep 18 06:30:53 2013 +0200 @@ -7464,13 +7464,15 @@ return false; } + + //----- (00439FCB) -------------------------------------------------------- void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) { signed int v4; // esi@1 unsigned int v5; // ecx@1 - Player *v6; // ebx@3 - Actor *v7; // esi@3 + Player *playerPtr; // ebx@3 + Actor *actorPtr; // esi@3 unsigned int v8; // eax@4 char *v9; // eax@5 signed int v10; // eax@6 @@ -7550,16 +7552,19 @@ uActorID = v4; if ( v5 ) { - if ( v5 != 1 - || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], - v75 = v6->sHealth, - !stru_50C198.ActorHitOrMiss(v7, v6)) ) + playerPtr = &pParty->pPlayers[a4]; + actorPtr = &pActors[v4]; + v75 = playerPtr->sHealth; + if ( v5 != 1 || !stru_50C198.ActorHitOrMiss(actorPtr, playerPtr) ) return; - v8 = v6->pEquipment.uArmor; + v8 = playerPtr->pEquipment.uArmor; if ( !v8 - || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) - || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) - || v10 > 11 ) + || playerPtr->pInventoryItemList[v8 - 1].IsBroken() + || + (pItemsTable->pItems[playerPtr->pInventoryItemList[v8 - 1].uItemID].uSkillType != PLAYER_SKILL_CHAIN + && pItemsTable->pItems[playerPtr->pInventoryItemList[v8 - 1].uItemID].uSkillType != PLAYER_SKILL_PLATE + ) + ) { v14 = rand() % 4; switch (v14) @@ -7582,29 +7587,29 @@ } } pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); - v18 = Actor::_43B3E0_CalcDamage(v7, v74); - v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; - v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; + v18 = Actor::_43B3E0_CalcDamage(actorPtr, v74); + v19 = HIDWORD(actorPtr->pActorBuffs[3].uExpireTime) == 0; + v20 = SHIDWORD(actorPtr->pActorBuffs[3].uExpireTime) < 0; v77 = v18; - if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) - { - v21 = v7->pActorBuffs[3].uPower; + if ( !v20 && (!(v20 | v19) || LODWORD(actorPtr->pActorBuffs[3].uExpireTime) > 0) ) + { + v21 = actorPtr->pActorBuffs[3].uPower; if ( v21 ) v77 /= (signed int)v21; } switch (v74) { - case 0: v22 = v7->pMonsterInfo.uAttack1Type; + case 0: v22 = actorPtr->pMonsterInfo.uAttack1Type; break; - case 1: v22 = v7->pMonsterInfo.uAttack2Type; + case 1: v22 = actorPtr->pMonsterInfo.uAttack2Type; break; - case 2: v23 = v7->pMonsterInfo.uSpell1ID; + case 2: v23 = actorPtr->pMonsterInfo.uSpell1ID; v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); break; - case 3: v23 = v7->pMonsterInfo.uSpell2ID; + case 3: v23 = actorPtr->pMonsterInfo.uSpell2ID; v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); break; - case 4: v22 = v7->pMonsterInfo.field_3C_some_special_attack; + case 4: v22 = actorPtr->pMonsterInfo.field_3C_some_special_attack; break; default: case 5: v22 = 4; //yes, the original just assigned the value 4 @@ -7612,68 +7617,68 @@ } if ( !(dword_6BE368_debug_settings_2 & 0x10) ) { - v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); - if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 - && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) + v24 = playerPtr->ReceiveDamage(v77, (DAMAGE_TYPE)v22); + if ( SHIDWORD(playerPtr->pPlayerBuffs[10].uExpireTime) >= 0 + && (SHIDWORD(playerPtr->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(playerPtr->pPlayerBuffs[10].uExpireTime)) ) { - v25 = v7->uAIState; + v25 = actorPtr->uAIState; if ( v25 != Dying && v25 != Dead) { - v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); - v7->sCurrentHP -= v26; + v26 = stru_50C198.CalcMagicalDamageToActor(actorPtr, v22, v24); + actorPtr->sCurrentHP -= v26; if ( v26 ) { - if ( v7->sCurrentHP >= 1 ) + if ( actorPtr->sCurrentHP >= 1 ) { Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); Actor::AggroSurroundingPeasants(uActorID, 1); } else { - if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) + if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 ) { - v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; + v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius; if ( pRenderer->pRenderD3D ) { if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) { - pDecalBuilder->AddBloodsplat(v7->vPosition.x, v7->vPosition.y, v7->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, v27, 0, 0); } } } Actor::Die(uActorID); Actor::ApplyFineForKillingPeasant(uActorID); Actor::AggroSurroundingPeasants(uActorID, 1); - if ( v7->pMonsterInfo.uExp ) - GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); + if ( actorPtr->pMonsterInfo.uExp ) + GivePartyExp(pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].uExp); v34 = SPEECH_51; if ( rand() % 100 < 20 ) - v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; - v6->PlaySound((PlayerSpeech)v34, 0); + v34 = ((signed int)actorPtr->pMonsterInfo.uHP >= 100) + 1; + playerPtr->PlaySound((PlayerSpeech)v34, 0); } } } } if ( !(dword_6BE368_debug_settings_2 & 0x10) - && v7->pMonsterInfo.uSpecialAttack - && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) - v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); + && actorPtr->pMonsterInfo.uSpecialAttack + && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackType ) + playerPtr->_48DCF6(actorPtr->pMonsterInfo.uSpecialAttack, actorPtr); } if ( !pParty->bTurnBasedModeOn ) { - v35 = v6->GetActualEndurance(); - v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; - v6->SetRecoveryTime((signed __int64)v36); + v35 = playerPtr->GetActualEndurance(); + v36 = (double)(20 - playerPtr->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; + playerPtr->SetRecoveryTime((signed __int64)v36); } if ( v77 ) { v73 = (double)(signed int)v75; - if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) + if ( (double)playerPtr->GetMaxHealth() * 0.25 < v73 ) { - if ( v6->sHealth > 0 ) + if ( playerPtr->sHealth > 0 ) { - if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) - v6->PlaySound(SPEECH_48, 0); + if ( (double)playerPtr->GetMaxHealth() * 0.25 >= (double)playerPtr->sHealth ) + playerPtr->PlaySound(SPEECH_48, 0); } } } @@ -7739,13 +7744,13 @@ 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((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) + if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) v77 >>= 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((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) + if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) v77 >>= 1; } LABEL_115: