Mercurial > mm7
diff mm7_5.cpp @ 303:3dcc9d945eeb
DamageMonsterFromParty
author | Nomad |
---|---|
date | Tue, 19 Feb 2013 15:39:50 +0200 |
parents | af7e848d6def |
children | f16ac5e65438 |
line wrap: on
line diff
--- a/mm7_5.cpp Tue Feb 19 13:31:50 2013 +0200 +++ b/mm7_5.cpp Tue Feb 19 15:39:50 2013 +0200 @@ -1,3 +1,5 @@ +#include <assert.h> + #include "mm7.h" #include "MapInfo.h" @@ -4981,7 +4983,7 @@ { v4 = &pLayingItems[v3]; v36 = v4; - v5 = v4->field_58; + v5 = v4->field_58_pid; v2 = v5 & 7; v3 = v5 >> 3; } @@ -5110,14 +5112,14 @@ v35->z = v44; switch ( v41 ) { - case 4: + case OBJECT_Player: DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); break; - case 3: + case OBJECT_Actor: if ( v36 && pActors[v37].GetActorsRelation(v28) ) sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); break; - case 2: + case OBJECT_Item: sub_43B057(*((short *)v1 - 300), uActorID, v35); break; } @@ -5144,11 +5146,11 @@ //----- (00439474) -------------------------------------------------------- void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) { - signed int v3; // eax@1 + //signed int v3; // eax@1 LayingItem *v4; // ebx@1 - int v5; // edx@3 - bool uPlayerID; // eax@3 - Player *pPlayer; // edi@4 + //int v5; // edx@3 + //bool uPlayerID; // eax@3 + //Player *pPlayer; // edi@4 Actor *pMonster; // esi@7 LayingItem *v9; // ebx@12 int v10; // eax@12 @@ -5168,8 +5170,8 @@ unsigned __int8 v24; // sf@44 int v25; // edx@51 int v26; // ecx@51 - signed int v27; // eax@51 - int v28; // eax@53 + //signed int v27; // eax@51 + //int v28; // eax@53 signed int v29; // eax@76 signed int v30; // eax@84 signed int v31; // eax@92 @@ -5192,14 +5194,14 @@ 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 + //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 + //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 + //int v58; // [sp+4Ch] [bp-20h]@10 int v59; // [sp+50h] [bp-1Ch]@1 unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1 int v61; // [sp+58h] [bp-14h]@1 @@ -5208,10 +5210,10 @@ int a2; // [sp+64h] [bp-8h]@27 int a3; // [sp+6Bh] [bp-1h]@6 - v3 = a1; + //v3 = a1; v4 = 0; uActorID_Monster_ = uActorID_Monster; - v54 = a1; + //v54 = a1; uDamageAmount = 0; a4 = 0; v61 = 0; @@ -5220,94 +5222,96 @@ if ( (a1 & 7) == OBJECT_Item) { v4 = &pLayingItems[a1 >> 3]; - uDamageAmount = (int)v4; + //uDamageAmount = (int)v4; v61 = v4->field_60_distance_related_prolly_lod; - v3 = v4->field_58; - v54 = v4->field_58; - } - v5 = v3 & 7; - uPlayerID = v3 >> 3; - if (v5 != OBJECT_Player) + a1 = v4->field_58_pid; + //v54 = v4->field_58_pid; + } + //v5 = a1 & 7; + //uPlayerID = a1 >> 3; + if ((a1 & 7) != OBJECT_Player) return; - pPlayer = &pParty->pPlayers[uPlayerID]; - if ( uPlayerID < 0 && uPlayerID > 3 ) - { - MessageBoxW(nullptr, L"Invalid player in damageMonsterFromParty!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Damage.cpp:457", 0); - } + + assert(abs(a1 >> 3) < 4); + auto player = &pParty->pPlayers[a1 >> 3]; pMonster = &pActors[uActorID_Monster_]; - uPlayerID = pMonster->IsAlive(); - if ( uPlayerID ) + //uPlayerID = pMonster->IsAlive(); + if (pMonster->IsNotAlive()) return; + BYTE1(pMonster->uAttributes) |= 0xC0u; if ( pMonster->uAIState == Fleeing ) pMonster->uAttributes |= 0x20000u; - v58 = 0; - v53 = 0; - v57 = 0; + //v57 = 0; + //v53 = 0; + //v58 = 0; + bool hit_will_stun = false, + hit_will_paralyze = false; if ( !v4 ) { - v51 = (unsigned __int64 *)pPlayer->pEquipment.uMainHand; + //v51 = (unsigned __int64 *)player->pEquipment.uMainHand; + int main_hand_idx = player->pEquipment.uMainHand; v59 = 1; - if ( pPlayer->HasItemEquipped(EQUIP_TWO_HANDED) ) - { - v55 = pItemsTable->pItems[*(int *)&pPlayer->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)v51 + 5]].uSkillType; - v28 = SkillToMastery(pPlayer->pActiveSkills[v55]); - uDamageAmount = v28; - if ( v55 ) - { - if ( v55 == 6 ) - { - if ( v28 >= 3 ) - { - LOBYTE(v51) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F; - v51 = (unsigned __int64 *)(unsigned __int8)v51; - if ( rand() % 100 < (unsigned __int8)v51 ) - v58 = 1; - } - if ( uDamageAmount >= 4 ) - { - LOBYTE(v51) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F; - v51 = (unsigned __int64 *)(unsigned __int8)v51; - if ( rand() % 100 < (unsigned __int8)v51 ) - v53 = 1; - } - } - } - else - { - if ( uDamageAmount >= 3 ) - { - LOBYTE(v51) = pPlayer->GetActualSkillLevel((PLAYER_SKILL_TYPE)0) & 0x3F; - v51 = (unsigned __int64 *)(unsigned __int8)v51; - if ( rand() % 100 < (unsigned __int8)v51 ) - v58 = 1; - } + if ( player->HasItemEquipped(EQUIP_TWO_HANDED) ) + { + auto main_hand_skill = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; + //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; + //v28 = SkillToMastery(player->pActiveSkills[v55]); + auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]); + //uDamageAmount = v28; + switch (main_hand_skill) + { + case PLAYER_SKILL_STAFF: + if (main_hand_mastery >= 3) + { + if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_STAFF) & 0x3F) // stun chance when mastery >= 3 + hit_will_stun = true; + } + break; + + case PLAYER_SKILL_MACE: + if (main_hand_mastery >= 3) + { + if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F) + hit_will_stun = true; + } + if (main_hand_mastery >= 4) + { + if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F) + hit_will_paralyze = true; + } + break; } } v50 = pMonster->pMonsterInfo.uID; a2 = 4; - v27 = pPlayer->CalculateMeleeDamageTo(0, 0, v50); - goto LABEL_65; - } + //v27 = player->CalculateMeleeDamageTo(0, 0, v50); + uDamageAmount = player->CalculateMeleeDamageTo(0, 0, v50); + //if ( !v57 ) + goto LABEL_67; + //goto LABEL_69; + } + + v19 = v4->field_48 == 99; v61 = v4->field_60_distance_related_prolly_lod; if ( !v19 ) { v9 = (LayingItem *)uDamageAmount; v50 = pParty->vPosition.x - *(int *)(uDamageAmount + 4); - v55 = abs(v50); + //v55 = abs(v50); pMonsterName = (char *)(pParty->vPosition.y - v9->vPosition.y); - v51 = (unsigned __int64 *)abs((int)pMonsterName); + //v51 = (unsigned __int64 *)abs((int)pMonsterName); pPlayerName = (char *)(pParty->vPosition.z - v9->vPosition.z); v52 = abs((int)pPlayerName); - v61 = v55; - v10 = v55; - v11 = (int)v51; + v61 = abs(v50); + v10 = abs(v50); + v11 = (int)abs((int)pMonsterName); v12 = v52; - if ( v55 < (signed int)v51 ) - { - v10 = (int)v51; - v11 = v55; + if ( v10 < v11) + { + v10 = (int)v11; + v11 = v10; } if ( v10 < v52 ) { @@ -5321,9 +5325,9 @@ v12 = v11; v11 = v14; } - uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; - v61 = uPlayerID; - if ( uPlayerID >= 2560 ) + //uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; + v61 = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; + if ( v61 >= 2560 ) { if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) return; @@ -5335,15 +5339,16 @@ } v4 = (LayingItem *)uDamageAmount; } + v15 = v4->field_48; if ( v15 == 102 ) { - v16 = pPlayer->pActiveSkills[7]; + v16 = player->pActiveSkills[7]; v61 = 1; if ( (signed int)SkillToMastery(v16) >= 3 ) - a4 = pPlayer->pActiveSkills[7] & 0x3F; + a4 = player->pActiveSkills[7] & 0x3F; a2 = 4; - uDamageAmount = pPlayer->CalculateMeleeDamageTo(1, 1, 0); + uDamageAmount = player->CalculateMeleeDamageTo(1, 1, 0); goto LABEL_67; } if ( v15 != 100 ) @@ -5351,7 +5356,7 @@ if ( v15 == 101 ) { a2 = 0; - v18 = pPlayer->CalculateRangedDamageTo(0); + v18 = player->CalculateRangedDamageTo(0); v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; uDamageAmount = v18; @@ -5363,7 +5368,7 @@ if ( v15 == 39 ) { a4 = 5 * v4->field_4C; - a2 = pPlayer->GetSpellSchool(0x27u); + a2 = player->GetSpellSchool(0x27u); v21 = v4->field_4C; v50 = pMonster->sCurrentHP; pMonsterName = (char *)v4->field_50; @@ -5375,10 +5380,10 @@ uDamageAmount >>= 1; v59 = 0; LABEL_67: - if ( !stru_50C198.PlayerHitOrMiss(pPlayer, pMonster, v61, a4) ) - { -LABEL_68: - pPlayer->PlaySound(SPEECH_52, 0); + if ( !stru_50C198.PlayerHitOrMiss(player, pMonster, v61, a4) ) + { +//LABEL_68: + player->PlaySound(SPEECH_52, 0); return; } goto LABEL_69; @@ -5387,27 +5392,30 @@ { uDamageAmount = 0; a2 = 4; - v58 = 1; + hit_will_stun = 1; goto LABEL_67; } v50 = v4->field_48; - a2 = pPlayer->GetSpellSchool(v50); + a2 = player->GetSpellSchool(v50); v25 = v4->field_4C; v26 = v4->field_48; v50 = pMonster->sCurrentHP; pMonsterName = (char *)v4->field_50; - v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); + //v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); v59 = 0; - v57 = (PlayerEquipment *)1; -LABEL_65: - uDamageAmount = v27; - goto LABEL_66; + //v57 = (PlayerEquipment *)1; +//LABEL_65: + uDamageAmount = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); + //if ( !v57 ) + // goto LABEL_67; + goto LABEL_69; } v50 = pMonster->word_000086_some_monster_id; a2 = 4; - v17 = pPlayer->CalculateRangedDamageTo(v50); + v17 = player->CalculateRangedDamageTo(v50); v19 = v4->stru_24.uItemID == 0; uDamageAmount = v17; + v57 = 0; if ( !v19 && v4->stru_24.uAdditionalValue == 3 ) { a2 = 0; @@ -5417,18 +5425,18 @@ && (SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) > 0 || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) uDamageAmount >>= 1; v59 = 1; -LABEL_66: +//LABEL_66: if ( !v57 ) goto LABEL_67; LABEL_69: - if ( pPlayer->pConditions[1] ) - uDamageAmount >>= 1; + if (player->Weak()) + uDamageAmount /= 1; if ( (signed __int64)pMonster->pActorBuffs[5].uExpireTime > 0 ) uDamageAmount = 0; v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, uDamageAmount); - if ( !v4 && pPlayer->IsUnarmed() && (signed __int64)pPlayer->pPlayerBuffs[6].uExpireTime > 0 ) - { - v50 = pPlayer->pPlayerBuffs[6].uPower; + if ( !v4 && player->IsUnarmed() && (signed __int64)player->pPlayerBuffs[6].uExpireTime > 0 ) + { + v50 = player->pPlayerBuffs[6].uPower; v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, v50); v61 += v29; } @@ -5440,9 +5448,9 @@ a4 = v4->stru_24._439DF3_get_additional_damage(&a2, &v62); if ( v62 && pMonster->sCurrentHP > 0 ) { - pPlayer->sHealth += v61 / 5; - if ( pPlayer->sHealth > pPlayer->GetMaxHealth() ) - pPlayer->sHealth = pPlayer->GetMaxHealth(); + player->sHealth += v61 / 5; + if ( player->sHealth > player->GetMaxHealth() ) + player->sHealth = player->GetMaxHealth(); v62 = 0; } v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); @@ -5451,18 +5459,18 @@ else { v59 = 0; - v57 = &pPlayer->pEquipment; + v57 = &player->pEquipment; do { - if ( pPlayer->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) - { - auto _s = (ItemGen *)&pPlayer->pInventoryItems[v57->uOffHand-1]; + if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) + { + auto _s = (ItemGen *)&player->pInventoryItems[v57->uOffHand-1]; a4 = _s->_439DF3_get_additional_damage(&a2, &v62); if ( v62 && pMonster->sCurrentHP > 0 ) { - pPlayer->sHealth += v61 / 5; - if ( pPlayer->sHealth > pPlayer->GetMaxHealth() ) - pPlayer->sHealth = pPlayer->GetMaxHealth(); + player->sHealth += v61 / 5; + if ( player->sHealth > player->GetMaxHealth() ) + player->sHealth = player->GetMaxHealth(); v62 = 0; } v31 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); @@ -5476,22 +5484,25 @@ } v32 = uDamageAmount; pMonster->sCurrentHP -= uDamageAmount; - if ( !v32 && !v58 ) - goto LABEL_68; + if ( !v32 && !hit_will_stun ) + { + player->PlaySound(SPEECH_52, 0); + return; + } if ( pMonster->sCurrentHP > 0 ) { - Actor::_4030AD(uActorID_Monster_, v54, 0); + Actor::_4030AD(uActorID_Monster_, a1, 0); Actor::_43AC45(uActorID_Monster_, 1); if ( bShowDamage ) { v50 = uDamageAmount; pMonsterName = (char *)pMonster; - pPlayerName = pPlayer->pName; + pPlayerName = player->pName; if ( v4 ) v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points" else v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage" - sprintf(pTmpBuf, v47, pPlayerName, pMonsterName, v50); + sprintfex(pTmpBuf, v47, pPlayerName, pMonsterName, v50); ShowStatusBarString(pTmpBuf, 2u); } v41 = 0; @@ -5501,7 +5512,7 @@ if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 ) { v33 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; - v55 = v33; + //v55 = v33; if ( pRenderer->pRenderD3D ) { if ( pGame->uFlags2 & 0x20 ) @@ -5509,18 +5520,18 @@ v50 = 0; pMonsterName = 0; v34 = pMonster->vPosition.z; - *(float *)&pPlayerName = (double)v55; - v51 = (unsigned __int64 *)v34; + *(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)v51; - v51 = (unsigned __int64 *)v35; + v36 = (double)(signed int)pMonster->vPosition.z; + //v51 = (unsigned __int64 *)v35; v37 = v36; - v51 = (unsigned __int64 *)pMonster->vPosition.x; + //v51 = (unsigned __int64 *)pMonster->vPosition.x; v38 = (double)v35; - v39 = (double)(signed int)v51; + v39 = (double)(signed int)pMonster->vPosition.x; pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0); } } @@ -5533,14 +5544,14 @@ v40 = SPEECH_51; if ( rand() % 100 < 20 ) v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1; - pPlayer->PlaySound((PlayerSpeech)v40, 0); + player->PlaySound((PlayerSpeech)v40, 0); v41 = 0; if ( bShowDamage ) { v50 = (int)pMonster; pMonsterName = (char *)uDamageAmount; - pPlayerName = pPlayer->pName; // "%s inflicts %lu points killing %s" - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[175], pPlayer->pName, uDamageAmount, pMonster); + pPlayerName = player->pName; // "%s inflicts %lu points killing %s" + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster); ShowStatusBarString(pTmpBuf, 2u); } } @@ -5548,10 +5559,10 @@ && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41) && uDamageAmount != v41 ) - pPlayer->ReceiveDamage(uDamageAmount, a2); + player->ReceiveDamage(uDamageAmount, a2); v50 = 24; v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; - if ( (pPlayer->_48EA46_calc_special_bonus_by_items(24) || v58 != v41) + if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41) && stru_50C198.GetMagicalResistance(pMonster, 3u) ) { LODWORD(v42) = 20; @@ -5562,28 +5573,28 @@ if ( bShowDamage != v41 ) { v50 = (int)pMonster; - pMonsterName = pPlayer->pName; // "%s stuns %s" - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[635], pPlayer->pName, pMonster); + pMonsterName = player->pName; // "%s stuns %s" + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[635], player->pName, pMonster); ShowStatusBarString(pTmpBuf, 2u); } } - if ( v53 != v41 ) + if ( hit_will_paralyze != v41 ) { if ( pMonster->CanAct() ) { - if ( stru_50C198.GetMagicalResistance(pMonster, 3u) ) - { - LOBYTE(v43) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE); + if ( stru_50C198.GetMagicalResistance(pMonster, 3) ) + { + LOBYTE(v43) = player->GetActualSkillLevel(PLAYER_SKILL_MACE); v44 = v43; v45 = SkillToMastery(v43); - v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F)); - v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v51 * 0.033333335); + //v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F)); + v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(7680 * (v44 & 0x3F)) * 0.033333335); pMonster->pActorBuffs[6].Apply(v46, v45, 0, 0, 0); if ( bShowDamage ) { v50 = (int)pMonster; - pMonsterName = pPlayer->pName; // "%s paralyzes %s" - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[636], pPlayer->pName, pMonster); + pMonsterName = player->pName; // "%s paralyzes %s" + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[636], player->pName, pMonster); ShowStatusBarString(pTmpBuf, 2u); } } @@ -5883,10 +5894,10 @@ return; } v37 = &pLayingItems[uActorID]; - v38 = v37->field_58 & 7; - v39 = v37->field_58 >> 3; - v40 = v37->field_58 & 7; - uActorID = v37->field_58 >> 3; + v38 = v37->field_58_pid & 7; + v39 = v37->field_58_pid >> 3; + v40 = v37->field_58_pid & 7; + uActorID = v37->field_58_pid >> 3; v41 = v40 - 2; if ( !v41 ) goto LABEL_80; @@ -6072,7 +6083,7 @@ v43 = &pParty->pPlayers[a4]; LABEL_168: a4b = v43; - if ( v38 != 4 || v37->field_48 != 100 ) + if ( v38 != OBJECT_Player || v37->field_48 != 100 ) { v70 = v43->GetMaxHealth(); v68 = _43AFE3_calc_spell_damage(v37->field_48, v37->field_4C, v37->field_50, v70); @@ -6084,7 +6095,7 @@ v69 = 0; } a4b->ReceiveDamage(v68, v69); - if ( v38 == 4 && !qword_A750D8 ) + if ( v38 == OBJECT_Player && !qword_A750D8 ) { qword_A750D8 = 256i64; word_A750E0 = 44; @@ -6124,7 +6135,7 @@ v6 = uLayingItemID; v2 = uLayingItemID; v3 = a2 >> 3; - v4 = pLayingItems[uLayingItemID].field_58 & 7; + v4 = pLayingItems[uLayingItemID].field_58_pid & 7; v5 = (a2 & 7) - 3; if ( v5 ) { @@ -6296,7 +6307,7 @@ uActorIDa = uActorID; pActor = &pActors[uActorID]; a2 = uObjID; - if ( !pActors[uActorID].IsAlive() ) + if ( !pActors[uActorID].IsNotAlive() ) { if ( (a2 & 7) == OBJECT_Item) { @@ -6361,14 +6372,14 @@ { v5 = &pLayingItems[a1 >> 3]; v4 = v5->field_60_distance_related_prolly_lod; - v17 = v5->field_58; + v17 = v5->field_58_pid; } LOWORD(v6) = v17 & 7; - if ( v6 == 3 ) + if ( v6 == OBJECT_Actor) { v7 = &pActors[a2]; v8 = &pActors[v17 >> 3]; - v6 = pActors[a2].IsAlive(); + v6 = pActors[a2].IsNotAlive(); if ( !v6 ) { v9 = v7->uAIState == 7; @@ -12088,7 +12099,7 @@ if ( (v6 & 0x100000) == v8 ) { ++*v1; - if ( v5->IsAlive() == 1 ) + if ( v5->IsNotAlive() == 1 ) ++v3; } ++v4; @@ -12127,7 +12138,7 @@ if ( v4->pMonsterInfo.field_33 == v7 ) { ++*v2; - if ( v4->IsAlive() == 1 ) + if ( v4->IsNotAlive() == 1 ) ++v9; } } @@ -12167,7 +12178,7 @@ if ( v4->uGroup == v7 ) { ++*v2; - if ( v4->IsAlive() == 1 ) + if ( v4->IsNotAlive() == 1 ) ++v9; } } @@ -12197,7 +12208,7 @@ if ( (v6 & 0x100000) == v4 ) { *v3 = 1; - if ( pActors[v2].IsAlive() == 1 ) + if ( pActors[v2].IsNotAlive() == 1 ) v5 = 1; } return v5;