comparison mm7_5.cpp @ 303:3dcc9d945eeb

DamageMonsterFromParty
author Nomad
date Tue, 19 Feb 2013 15:39:50 +0200
parents af7e848d6def
children f16ac5e65438
comparison
equal deleted inserted replaced
296:af7e848d6def 303:3dcc9d945eeb
1 #include <assert.h>
2
1 #include "mm7.h" 3 #include "mm7.h"
2 4
3 #include "MapInfo.h" 5 #include "MapInfo.h"
4 #include "Game.h" 6 #include "Game.h"
5 #include "GUIWindow.h" 7 #include "GUIWindow.h"
4979 v39 = (signed int)*((short *)v1 - 300) >> 3; 4981 v39 = (signed int)*((short *)v1 - 300) >> 3;
4980 if ( v2 == 2 ) 4982 if ( v2 == 2 )
4981 { 4983 {
4982 v4 = &pLayingItems[v3]; 4984 v4 = &pLayingItems[v3];
4983 v36 = v4; 4985 v36 = v4;
4984 v5 = v4->field_58; 4986 v5 = v4->field_58_pid;
4985 v2 = v5 & 7; 4987 v2 = v5 & 7;
4986 v3 = v5 >> 3; 4988 v3 = v5 >> 3;
4987 } 4989 }
4988 v41 = v2; 4990 v41 = v2;
4989 v37 = v3; 4991 v37 = v3;
5108 pVelocity->x = a1; 5110 pVelocity->x = a1;
5109 v35->y = v48; 5111 v35->y = v48;
5110 v35->z = v44; 5112 v35->z = v44;
5111 switch ( v41 ) 5113 switch ( v41 )
5112 { 5114 {
5113 case 4: 5115 case OBJECT_Player:
5114 DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); 5116 DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35);
5115 break; 5117 break;
5116 case 3: 5118 case OBJECT_Actor:
5117 if ( v36 && pActors[v37].GetActorsRelation(v28) ) 5119 if ( v36 && pActors[v37].GetActorsRelation(v28) )
5118 sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); 5120 sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61);
5119 break; 5121 break;
5120 case 2: 5122 case OBJECT_Item:
5121 sub_43B057(*((short *)v1 - 300), uActorID, v35); 5123 sub_43B057(*((short *)v1 - 300), uActorID, v35);
5122 break; 5124 break;
5123 } 5125 }
5124 } 5126 }
5125 } 5127 }
5142 // 50FE08: using guessed type stru298 stru_50FE08; 5144 // 50FE08: using guessed type stru298 stru_50FE08;
5143 5145
5144 //----- (00439474) -------------------------------------------------------- 5146 //----- (00439474) --------------------------------------------------------
5145 void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) 5147 void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity)
5146 { 5148 {
5147 signed int v3; // eax@1 5149 //signed int v3; // eax@1
5148 LayingItem *v4; // ebx@1 5150 LayingItem *v4; // ebx@1
5149 int v5; // edx@3 5151 //int v5; // edx@3
5150 bool uPlayerID; // eax@3 5152 //bool uPlayerID; // eax@3
5151 Player *pPlayer; // edi@4 5153 //Player *pPlayer; // edi@4
5152 Actor *pMonster; // esi@7 5154 Actor *pMonster; // esi@7
5153 LayingItem *v9; // ebx@12 5155 LayingItem *v9; // ebx@12
5154 int v10; // eax@12 5156 int v10; // eax@12
5155 int v11; // ebx@12 5157 int v11; // ebx@12
5156 unsigned int v12; // ecx@12 5158 unsigned int v12; // ecx@12
5166 int v22; // eax@44 5168 int v22; // eax@44
5167 unsigned __int8 v23; // zf@44 5169 unsigned __int8 v23; // zf@44
5168 unsigned __int8 v24; // sf@44 5170 unsigned __int8 v24; // sf@44
5169 int v25; // edx@51 5171 int v25; // edx@51
5170 int v26; // ecx@51 5172 int v26; // ecx@51
5171 signed int v27; // eax@51 5173 //signed int v27; // eax@51
5172 int v28; // eax@53 5174 //int v28; // eax@53
5173 signed int v29; // eax@76 5175 signed int v29; // eax@76
5174 signed int v30; // eax@84 5176 signed int v30; // eax@84
5175 signed int v31; // eax@92 5177 signed int v31; // eax@92
5176 int v32; // eax@94 5178 int v32; // eax@94
5177 int v33; // eax@100 5179 int v33; // eax@100
5190 unsigned __int64 v46; // [sp+Ch] [bp-60h]@6 5192 unsigned __int64 v46; // [sp+Ch] [bp-60h]@6
5191 const char *v47; // [sp+14h] [bp-58h]@104 5193 const char *v47; // [sp+14h] [bp-58h]@104
5192 char *pPlayerName; // [sp+18h] [bp-54h]@12 5194 char *pPlayerName; // [sp+18h] [bp-54h]@12
5193 char *pMonsterName; // [sp+1Ch] [bp-50h]@6 5195 char *pMonsterName; // [sp+1Ch] [bp-50h]@6
5194 int v50; // [sp+20h] [bp-4Ch]@6 5196 int v50; // [sp+20h] [bp-4Ch]@6
5195 unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6 5197 //unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6
5196 int v52; // [sp+34h] [bp-38h]@12 5198 int v52; // [sp+34h] [bp-38h]@12
5197 int v53; // [sp+38h] [bp-34h]@10 5199 //int v53; // [sp+38h] [bp-34h]@10
5198 int v54; // [sp+3Ch] [bp-30h]@1 5200 //int v54; // [sp+3Ch] [bp-30h]@1
5199 int v55; // [sp+40h] [bp-2Ch]@12 5201 //int v55; // [sp+40h] [bp-2Ch]@12
5200 signed int a4; // [sp+44h] [bp-28h]@1 5202 signed int a4; // [sp+44h] [bp-28h]@1
5201 PlayerEquipment *v57; // [sp+48h] [bp-24h]@10 5203 PlayerEquipment *v57; // [sp+48h] [bp-24h]@10
5202 int v58; // [sp+4Ch] [bp-20h]@10 5204 //int v58; // [sp+4Ch] [bp-20h]@10
5203 int v59; // [sp+50h] [bp-1Ch]@1 5205 int v59; // [sp+50h] [bp-1Ch]@1
5204 unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1 5206 unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1
5205 int v61; // [sp+58h] [bp-14h]@1 5207 int v61; // [sp+58h] [bp-14h]@1
5206 int v62; // [sp+5Ch] [bp-10h]@1 5208 int v62; // [sp+5Ch] [bp-10h]@1
5207 int uDamageAmount; // [sp+60h] [bp-Ch]@1 5209 int uDamageAmount; // [sp+60h] [bp-Ch]@1
5208 int a2; // [sp+64h] [bp-8h]@27 5210 int a2; // [sp+64h] [bp-8h]@27
5209 int a3; // [sp+6Bh] [bp-1h]@6 5211 int a3; // [sp+6Bh] [bp-1h]@6
5210 5212
5211 v3 = a1; 5213 //v3 = a1;
5212 v4 = 0; 5214 v4 = 0;
5213 uActorID_Monster_ = uActorID_Monster; 5215 uActorID_Monster_ = uActorID_Monster;
5214 v54 = a1; 5216 //v54 = a1;
5215 uDamageAmount = 0; 5217 uDamageAmount = 0;
5216 a4 = 0; 5218 a4 = 0;
5217 v61 = 0; 5219 v61 = 0;
5218 v59 = 0; 5220 v59 = 0;
5219 v62 = 0; 5221 v62 = 0;
5220 if ( (a1 & 7) == OBJECT_Item) 5222 if ( (a1 & 7) == OBJECT_Item)
5221 { 5223 {
5222 v4 = &pLayingItems[a1 >> 3]; 5224 v4 = &pLayingItems[a1 >> 3];
5223 uDamageAmount = (int)v4; 5225 //uDamageAmount = (int)v4;
5224 v61 = v4->field_60_distance_related_prolly_lod; 5226 v61 = v4->field_60_distance_related_prolly_lod;
5225 v3 = v4->field_58; 5227 a1 = v4->field_58_pid;
5226 v54 = v4->field_58; 5228 //v54 = v4->field_58_pid;
5227 } 5229 }
5228 v5 = v3 & 7; 5230 //v5 = a1 & 7;
5229 uPlayerID = v3 >> 3; 5231 //uPlayerID = a1 >> 3;
5230 if (v5 != OBJECT_Player) 5232 if ((a1 & 7) != OBJECT_Player)
5231 return; 5233 return;
5232 pPlayer = &pParty->pPlayers[uPlayerID]; 5234
5233 if ( uPlayerID < 0 && uPlayerID > 3 ) 5235 assert(abs(a1 >> 3) < 4);
5234 { 5236 auto player = &pParty->pPlayers[a1 >> 3];
5235 MessageBoxW(nullptr, L"Invalid player in damageMonsterFromParty!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Damage.cpp:457", 0);
5236 }
5237 pMonster = &pActors[uActorID_Monster_]; 5237 pMonster = &pActors[uActorID_Monster_];
5238 uPlayerID = pMonster->IsAlive(); 5238 //uPlayerID = pMonster->IsAlive();
5239 if ( uPlayerID ) 5239 if (pMonster->IsNotAlive())
5240 return; 5240 return;
5241
5241 BYTE1(pMonster->uAttributes) |= 0xC0u; 5242 BYTE1(pMonster->uAttributes) |= 0xC0u;
5242 if ( pMonster->uAIState == Fleeing ) 5243 if ( pMonster->uAIState == Fleeing )
5243 pMonster->uAttributes |= 0x20000u; 5244 pMonster->uAttributes |= 0x20000u;
5244 v58 = 0; 5245 //v57 = 0;
5245 v53 = 0; 5246 //v53 = 0;
5246 v57 = 0; 5247 //v58 = 0;
5248 bool hit_will_stun = false,
5249 hit_will_paralyze = false;
5247 if ( !v4 ) 5250 if ( !v4 )
5248 { 5251 {
5249 v51 = (unsigned __int64 *)pPlayer->pEquipment.uMainHand; 5252 //v51 = (unsigned __int64 *)player->pEquipment.uMainHand;
5253 int main_hand_idx = player->pEquipment.uMainHand;
5250 v59 = 1; 5254 v59 = 1;
5251 if ( pPlayer->HasItemEquipped(EQUIP_TWO_HANDED) ) 5255 if ( player->HasItemEquipped(EQUIP_TWO_HANDED) )
5252 { 5256 {
5253 v55 = pItemsTable->pItems[*(int *)&pPlayer->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)v51 + 5]].uSkillType; 5257 auto main_hand_skill = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType;
5254 v28 = SkillToMastery(pPlayer->pActiveSkills[v55]); 5258 //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType;
5255 uDamageAmount = v28; 5259 //v28 = SkillToMastery(player->pActiveSkills[v55]);
5256 if ( v55 ) 5260 auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]);
5261 //uDamageAmount = v28;
5262 switch (main_hand_skill)
5257 { 5263 {
5258 if ( v55 == 6 ) 5264 case PLAYER_SKILL_STAFF:
5259 { 5265 if (main_hand_mastery >= 3)
5260 if ( v28 >= 3 ) 5266 {
5261 { 5267 if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_STAFF) & 0x3F) // stun chance when mastery >= 3
5262 LOBYTE(v51) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F; 5268 hit_will_stun = true;
5263 v51 = (unsigned __int64 *)(unsigned __int8)v51; 5269 }
5264 if ( rand() % 100 < (unsigned __int8)v51 ) 5270 break;
5265 v58 = 1; 5271
5266 } 5272 case PLAYER_SKILL_MACE:
5267 if ( uDamageAmount >= 4 ) 5273 if (main_hand_mastery >= 3)
5268 { 5274 {
5269 LOBYTE(v51) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F; 5275 if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F)
5270 v51 = (unsigned __int64 *)(unsigned __int8)v51; 5276 hit_will_stun = true;
5271 if ( rand() % 100 < (unsigned __int8)v51 ) 5277 }
5272 v53 = 1; 5278 if (main_hand_mastery >= 4)
5273 } 5279 {
5274 } 5280 if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F)
5275 } 5281 hit_will_paralyze = true;
5276 else 5282 }
5277 { 5283 break;
5278 if ( uDamageAmount >= 3 )
5279 {
5280 LOBYTE(v51) = pPlayer->GetActualSkillLevel((PLAYER_SKILL_TYPE)0) & 0x3F;
5281 v51 = (unsigned __int64 *)(unsigned __int8)v51;
5282 if ( rand() % 100 < (unsigned __int8)v51 )
5283 v58 = 1;
5284 }
5285 } 5284 }
5286 } 5285 }
5287 v50 = pMonster->pMonsterInfo.uID; 5286 v50 = pMonster->pMonsterInfo.uID;
5288 a2 = 4; 5287 a2 = 4;
5289 v27 = pPlayer->CalculateMeleeDamageTo(0, 0, v50); 5288 //v27 = player->CalculateMeleeDamageTo(0, 0, v50);
5290 goto LABEL_65; 5289 uDamageAmount = player->CalculateMeleeDamageTo(0, 0, v50);
5291 } 5290 //if ( !v57 )
5291 goto LABEL_67;
5292 //goto LABEL_69;
5293 }
5294
5295
5292 v19 = v4->field_48 == 99; 5296 v19 = v4->field_48 == 99;
5293 v61 = v4->field_60_distance_related_prolly_lod; 5297 v61 = v4->field_60_distance_related_prolly_lod;
5294 if ( !v19 ) 5298 if ( !v19 )
5295 { 5299 {
5296 v9 = (LayingItem *)uDamageAmount; 5300 v9 = (LayingItem *)uDamageAmount;
5297 v50 = pParty->vPosition.x - *(int *)(uDamageAmount + 4); 5301 v50 = pParty->vPosition.x - *(int *)(uDamageAmount + 4);
5298 v55 = abs(v50); 5302 //v55 = abs(v50);
5299 pMonsterName = (char *)(pParty->vPosition.y - v9->vPosition.y); 5303 pMonsterName = (char *)(pParty->vPosition.y - v9->vPosition.y);
5300 v51 = (unsigned __int64 *)abs((int)pMonsterName); 5304 //v51 = (unsigned __int64 *)abs((int)pMonsterName);
5301 pPlayerName = (char *)(pParty->vPosition.z - v9->vPosition.z); 5305 pPlayerName = (char *)(pParty->vPosition.z - v9->vPosition.z);
5302 v52 = abs((int)pPlayerName); 5306 v52 = abs((int)pPlayerName);
5303 v61 = v55; 5307 v61 = abs(v50);
5304 v10 = v55; 5308 v10 = abs(v50);
5305 v11 = (int)v51; 5309 v11 = (int)abs((int)pMonsterName);
5306 v12 = v52; 5310 v12 = v52;
5307 if ( v55 < (signed int)v51 ) 5311 if ( v10 < v11)
5308 { 5312 {
5309 v10 = (int)v51; 5313 v10 = (int)v11;
5310 v11 = v55; 5314 v11 = v10;
5311 } 5315 }
5312 if ( v10 < v52 ) 5316 if ( v10 < v52 )
5313 { 5317 {
5314 v13 = v10; 5318 v13 = v10;
5315 v10 = v52; 5319 v10 = v52;
5319 { 5323 {
5320 v14 = v12; 5324 v14 = v12;
5321 v12 = v11; 5325 v12 = v11;
5322 v11 = v14; 5326 v11 = v14;
5323 } 5327 }
5324 uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; 5328 //uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10;
5325 v61 = uPlayerID; 5329 v61 = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10;
5326 if ( uPlayerID >= 2560 ) 5330 if ( v61 >= 2560 )
5327 { 5331 {
5328 if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) 5332 if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) )
5329 return; 5333 return;
5330 v61 = 2; 5334 v61 = 2;
5331 } 5335 }
5333 { 5337 {
5334 v61 = 1; 5338 v61 = 1;
5335 } 5339 }
5336 v4 = (LayingItem *)uDamageAmount; 5340 v4 = (LayingItem *)uDamageAmount;
5337 } 5341 }
5342
5338 v15 = v4->field_48; 5343 v15 = v4->field_48;
5339 if ( v15 == 102 ) 5344 if ( v15 == 102 )
5340 { 5345 {
5341 v16 = pPlayer->pActiveSkills[7]; 5346 v16 = player->pActiveSkills[7];
5342 v61 = 1; 5347 v61 = 1;
5343 if ( (signed int)SkillToMastery(v16) >= 3 ) 5348 if ( (signed int)SkillToMastery(v16) >= 3 )
5344 a4 = pPlayer->pActiveSkills[7] & 0x3F; 5349 a4 = player->pActiveSkills[7] & 0x3F;
5345 a2 = 4; 5350 a2 = 4;
5346 uDamageAmount = pPlayer->CalculateMeleeDamageTo(1, 1, 0); 5351 uDamageAmount = player->CalculateMeleeDamageTo(1, 1, 0);
5347 goto LABEL_67; 5352 goto LABEL_67;
5348 } 5353 }
5349 if ( v15 != 100 ) 5354 if ( v15 != 100 )
5350 { 5355 {
5351 if ( v15 == 101 ) 5356 if ( v15 == 101 )
5352 { 5357 {
5353 a2 = 0; 5358 a2 = 0;
5354 v18 = pPlayer->CalculateRangedDamageTo(0); 5359 v18 = player->CalculateRangedDamageTo(0);
5355 v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; 5360 v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0;
5356 v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; 5361 v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0;
5357 uDamageAmount = v18; 5362 uDamageAmount = v18;
5358 if ( !v20 && (!(v20 | v19) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) 5363 if ( !v20 && (!(v20 | v19) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) )
5359 uDamageAmount >>= 1; 5364 uDamageAmount >>= 1;
5361 goto LABEL_67; 5366 goto LABEL_67;
5362 } 5367 }
5363 if ( v15 == 39 ) 5368 if ( v15 == 39 )
5364 { 5369 {
5365 a4 = 5 * v4->field_4C; 5370 a4 = 5 * v4->field_4C;
5366 a2 = pPlayer->GetSpellSchool(0x27u); 5371 a2 = player->GetSpellSchool(0x27u);
5367 v21 = v4->field_4C; 5372 v21 = v4->field_4C;
5368 v50 = pMonster->sCurrentHP; 5373 v50 = pMonster->sCurrentHP;
5369 pMonsterName = (char *)v4->field_50; 5374 pMonsterName = (char *)v4->field_50;
5370 v22 = _43AFE3_calc_spell_damage(39, v21, (signed int)pMonsterName, v50); 5375 v22 = _43AFE3_calc_spell_damage(39, v21, (signed int)pMonsterName, v50);
5371 v23 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; 5376 v23 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0;
5373 uDamageAmount = v22; 5378 uDamageAmount = v22;
5374 if ( !v24 && (!(v24 | v23) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) 5379 if ( !v24 && (!(v24 | v23) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) )
5375 uDamageAmount >>= 1; 5380 uDamageAmount >>= 1;
5376 v59 = 0; 5381 v59 = 0;
5377 LABEL_67: 5382 LABEL_67:
5378 if ( !stru_50C198.PlayerHitOrMiss(pPlayer, pMonster, v61, a4) ) 5383 if ( !stru_50C198.PlayerHitOrMiss(player, pMonster, v61, a4) )
5379 { 5384 {
5380 LABEL_68: 5385 //LABEL_68:
5381 pPlayer->PlaySound(SPEECH_52, 0); 5386 player->PlaySound(SPEECH_52, 0);
5382 return; 5387 return;
5383 } 5388 }
5384 goto LABEL_69; 5389 goto LABEL_69;
5385 } 5390 }
5386 if ( v15 == 34 ) 5391 if ( v15 == 34 )
5387 { 5392 {
5388 uDamageAmount = 0; 5393 uDamageAmount = 0;
5389 a2 = 4; 5394 a2 = 4;
5390 v58 = 1; 5395 hit_will_stun = 1;
5391 goto LABEL_67; 5396 goto LABEL_67;
5392 } 5397 }
5393 v50 = v4->field_48; 5398 v50 = v4->field_48;
5394 a2 = pPlayer->GetSpellSchool(v50); 5399 a2 = player->GetSpellSchool(v50);
5395 v25 = v4->field_4C; 5400 v25 = v4->field_4C;
5396 v26 = v4->field_48; 5401 v26 = v4->field_48;
5397 v50 = pMonster->sCurrentHP; 5402 v50 = pMonster->sCurrentHP;
5398 pMonsterName = (char *)v4->field_50; 5403 pMonsterName = (char *)v4->field_50;
5399 v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); 5404 //v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50);
5400 v59 = 0; 5405 v59 = 0;
5401 v57 = (PlayerEquipment *)1; 5406 //v57 = (PlayerEquipment *)1;
5402 LABEL_65: 5407 //LABEL_65:
5403 uDamageAmount = v27; 5408 uDamageAmount = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50);
5404 goto LABEL_66; 5409 //if ( !v57 )
5410 // goto LABEL_67;
5411 goto LABEL_69;
5405 } 5412 }
5406 v50 = pMonster->word_000086_some_monster_id; 5413 v50 = pMonster->word_000086_some_monster_id;
5407 a2 = 4; 5414 a2 = 4;
5408 v17 = pPlayer->CalculateRangedDamageTo(v50); 5415 v17 = player->CalculateRangedDamageTo(v50);
5409 v19 = v4->stru_24.uItemID == 0; 5416 v19 = v4->stru_24.uItemID == 0;
5410 uDamageAmount = v17; 5417 uDamageAmount = v17;
5418 v57 = 0;
5411 if ( !v19 && v4->stru_24.uAdditionalValue == 3 ) 5419 if ( !v19 && v4->stru_24.uAdditionalValue == 3 )
5412 { 5420 {
5413 a2 = 0; 5421 a2 = 0;
5414 v57 = (PlayerEquipment *)1; 5422 v57 = (PlayerEquipment *)1;
5415 } 5423 }
5416 if ( SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) >= 0 5424 if ( SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) >= 0
5417 && (SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) > 0 || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) 5425 && (SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) > 0 || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) )
5418 uDamageAmount >>= 1; 5426 uDamageAmount >>= 1;
5419 v59 = 1; 5427 v59 = 1;
5420 LABEL_66: 5428 //LABEL_66:
5421 if ( !v57 ) 5429 if ( !v57 )
5422 goto LABEL_67; 5430 goto LABEL_67;
5423 LABEL_69: 5431 LABEL_69:
5424 if ( pPlayer->pConditions[1] ) 5432 if (player->Weak())
5425 uDamageAmount >>= 1; 5433 uDamageAmount /= 1;
5426 if ( (signed __int64)pMonster->pActorBuffs[5].uExpireTime > 0 ) 5434 if ( (signed __int64)pMonster->pActorBuffs[5].uExpireTime > 0 )
5427 uDamageAmount = 0; 5435 uDamageAmount = 0;
5428 v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, uDamageAmount); 5436 v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, uDamageAmount);
5429 if ( !v4 && pPlayer->IsUnarmed() && (signed __int64)pPlayer->pPlayerBuffs[6].uExpireTime > 0 ) 5437 if ( !v4 && player->IsUnarmed() && (signed __int64)player->pPlayerBuffs[6].uExpireTime > 0 )
5430 { 5438 {
5431 v50 = pPlayer->pPlayerBuffs[6].uPower; 5439 v50 = player->pPlayerBuffs[6].uPower;
5432 v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, v50); 5440 v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, v50);
5433 v61 += v29; 5441 v61 += v29;
5434 } 5442 }
5435 uDamageAmount = v61; 5443 uDamageAmount = v61;
5436 if ( v59 ) 5444 if ( v59 )
5438 if ( v4 ) 5446 if ( v4 )
5439 { 5447 {
5440 a4 = v4->stru_24._439DF3_get_additional_damage(&a2, &v62); 5448 a4 = v4->stru_24._439DF3_get_additional_damage(&a2, &v62);
5441 if ( v62 && pMonster->sCurrentHP > 0 ) 5449 if ( v62 && pMonster->sCurrentHP > 0 )
5442 { 5450 {
5443 pPlayer->sHealth += v61 / 5; 5451 player->sHealth += v61 / 5;
5444 if ( pPlayer->sHealth > pPlayer->GetMaxHealth() ) 5452 if ( player->sHealth > player->GetMaxHealth() )
5445 pPlayer->sHealth = pPlayer->GetMaxHealth(); 5453 player->sHealth = player->GetMaxHealth();
5446 v62 = 0; 5454 v62 = 0;
5447 } 5455 }
5448 v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); 5456 v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4);
5449 uDamageAmount = v61 + v30; 5457 uDamageAmount = v61 + v30;
5450 } 5458 }
5451 else 5459 else
5452 { 5460 {
5453 v59 = 0; 5461 v59 = 0;
5454 v57 = &pPlayer->pEquipment; 5462 v57 = &player->pEquipment;
5455 do 5463 do
5456 { 5464 {
5457 if ( pPlayer->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) 5465 if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) )
5458 { 5466 {
5459 auto _s = (ItemGen *)&pPlayer->pInventoryItems[v57->uOffHand-1]; 5467 auto _s = (ItemGen *)&player->pInventoryItems[v57->uOffHand-1];
5460 a4 = _s->_439DF3_get_additional_damage(&a2, &v62); 5468 a4 = _s->_439DF3_get_additional_damage(&a2, &v62);
5461 if ( v62 && pMonster->sCurrentHP > 0 ) 5469 if ( v62 && pMonster->sCurrentHP > 0 )
5462 { 5470 {
5463 pPlayer->sHealth += v61 / 5; 5471 player->sHealth += v61 / 5;
5464 if ( pPlayer->sHealth > pPlayer->GetMaxHealth() ) 5472 if ( player->sHealth > player->GetMaxHealth() )
5465 pPlayer->sHealth = pPlayer->GetMaxHealth(); 5473 player->sHealth = player->GetMaxHealth();
5466 v62 = 0; 5474 v62 = 0;
5467 } 5475 }
5468 v31 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); 5476 v31 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4);
5469 uDamageAmount += v31; 5477 uDamageAmount += v31;
5470 } 5478 }
5474 while ( v59 <= 1 ); 5482 while ( v59 <= 1 );
5475 } 5483 }
5476 } 5484 }
5477 v32 = uDamageAmount; 5485 v32 = uDamageAmount;
5478 pMonster->sCurrentHP -= uDamageAmount; 5486 pMonster->sCurrentHP -= uDamageAmount;
5479 if ( !v32 && !v58 ) 5487 if ( !v32 && !hit_will_stun )
5480 goto LABEL_68; 5488 {
5489 player->PlaySound(SPEECH_52, 0);
5490 return;
5491 }
5481 if ( pMonster->sCurrentHP > 0 ) 5492 if ( pMonster->sCurrentHP > 0 )
5482 { 5493 {
5483 Actor::_4030AD(uActorID_Monster_, v54, 0); 5494 Actor::_4030AD(uActorID_Monster_, a1, 0);
5484 Actor::_43AC45(uActorID_Monster_, 1); 5495 Actor::_43AC45(uActorID_Monster_, 1);
5485 if ( bShowDamage ) 5496 if ( bShowDamage )
5486 { 5497 {
5487 v50 = uDamageAmount; 5498 v50 = uDamageAmount;
5488 pMonsterName = (char *)pMonster; 5499 pMonsterName = (char *)pMonster;
5489 pPlayerName = pPlayer->pName; 5500 pPlayerName = player->pName;
5490 if ( v4 ) 5501 if ( v4 )
5491 v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points" 5502 v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points"
5492 else 5503 else
5493 v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage" 5504 v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage"
5494 sprintf(pTmpBuf, v47, pPlayerName, pMonsterName, v50); 5505 sprintfex(pTmpBuf, v47, pPlayerName, pMonsterName, v50);
5495 ShowStatusBarString(pTmpBuf, 2u); 5506 ShowStatusBarString(pTmpBuf, 2u);
5496 } 5507 }
5497 v41 = 0; 5508 v41 = 0;
5498 } 5509 }
5499 else 5510 else
5500 { 5511 {
5501 if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 ) 5512 if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 )
5502 { 5513 {
5503 v33 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; 5514 v33 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius;
5504 v55 = v33; 5515 //v55 = v33;
5505 if ( pRenderer->pRenderD3D ) 5516 if ( pRenderer->pRenderD3D )
5506 { 5517 {
5507 if ( pGame->uFlags2 & 0x20 ) 5518 if ( pGame->uFlags2 & 0x20 )
5508 { 5519 {
5509 v50 = 0; 5520 v50 = 0;
5510 pMonsterName = 0; 5521 pMonsterName = 0;
5511 v34 = pMonster->vPosition.z; 5522 v34 = pMonster->vPosition.z;
5512 *(float *)&pPlayerName = (double)v55; 5523 *(float *)&pPlayerName = (double)v33;
5513 v51 = (unsigned __int64 *)v34; 5524 //v51 = (unsigned __int64 *)v34;
5514 *(float *)&v47 = 0.0; 5525 *(float *)&v47 = 0.0;
5515 v35 = pMonster->vPosition.y; 5526 v35 = pMonster->vPosition.y;
5516 *((float *)&v46 + 1) = 0.0; 5527 *((float *)&v46 + 1) = 0.0;
5517 *(float *)&v46 = 1.0; 5528 *(float *)&v46 = 1.0;
5518 v36 = (double)(signed int)v51; 5529 v36 = (double)(signed int)pMonster->vPosition.z;
5519 v51 = (unsigned __int64 *)v35; 5530 //v51 = (unsigned __int64 *)v35;
5520 v37 = v36; 5531 v37 = v36;
5521 v51 = (unsigned __int64 *)pMonster->vPosition.x; 5532 //v51 = (unsigned __int64 *)pMonster->vPosition.x;
5522 v38 = (double)v35; 5533 v38 = (double)v35;
5523 v39 = (double)(signed int)v51; 5534 v39 = (double)(signed int)pMonster->vPosition.x;
5524 pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0); 5535 pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0);
5525 } 5536 }
5526 } 5537 }
5527 } 5538 }
5528 Actor::Die(uActorID_Monster_); 5539 Actor::Die(uActorID_Monster_);
5531 if ( pMonster->pMonsterInfo.uExp ) 5542 if ( pMonster->pMonsterInfo.uExp )
5532 sub_4269A2_GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp); 5543 sub_4269A2_GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp);
5533 v40 = SPEECH_51; 5544 v40 = SPEECH_51;
5534 if ( rand() % 100 < 20 ) 5545 if ( rand() % 100 < 20 )
5535 v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1; 5546 v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1;
5536 pPlayer->PlaySound((PlayerSpeech)v40, 0); 5547 player->PlaySound((PlayerSpeech)v40, 0);
5537 v41 = 0; 5548 v41 = 0;
5538 if ( bShowDamage ) 5549 if ( bShowDamage )
5539 { 5550 {
5540 v50 = (int)pMonster; 5551 v50 = (int)pMonster;
5541 pMonsterName = (char *)uDamageAmount; 5552 pMonsterName = (char *)uDamageAmount;
5542 pPlayerName = pPlayer->pName; // "%s inflicts %lu points killing %s" 5553 pPlayerName = player->pName; // "%s inflicts %lu points killing %s"
5543 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[175], pPlayer->pName, uDamageAmount, pMonster); 5554 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster);
5544 ShowStatusBarString(pTmpBuf, 2u); 5555 ShowStatusBarString(pTmpBuf, 2u);
5545 } 5556 }
5546 } 5557 }
5547 if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41 5558 if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41
5548 && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41 5559 && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41
5549 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41) 5560 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41)
5550 && uDamageAmount != v41 ) 5561 && uDamageAmount != v41 )
5551 pPlayer->ReceiveDamage(uDamageAmount, a2); 5562 player->ReceiveDamage(uDamageAmount, a2);
5552 v50 = 24; 5563 v50 = 24;
5553 v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; 5564 v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP;
5554 if ( (pPlayer->_48EA46_calc_special_bonus_by_items(24) || v58 != v41) 5565 if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41)
5555 && stru_50C198.GetMagicalResistance(pMonster, 3u) ) 5566 && stru_50C198.GetMagicalResistance(pMonster, 3u) )
5556 { 5567 {
5557 LODWORD(v42) = 20; 5568 LODWORD(v42) = 20;
5558 v59 = 10; 5569 v59 = 10;
5559 if ( pParty->bTurnBasedModeOn == v41 ) 5570 if ( pParty->bTurnBasedModeOn == v41 )
5560 v42 = (signed __int64)(flt_6BE3A8_debug_recmod2 * 42.66666666666666); 5571 v42 = (signed __int64)(flt_6BE3A8_debug_recmod2 * 42.66666666666666);
5561 pMonster->pMonsterInfo.uRecoveryTime += v42; 5572 pMonster->pMonsterInfo.uRecoveryTime += v42;
5562 if ( bShowDamage != v41 ) 5573 if ( bShowDamage != v41 )
5563 { 5574 {
5564 v50 = (int)pMonster; 5575 v50 = (int)pMonster;
5565 pMonsterName = pPlayer->pName; // "%s stuns %s" 5576 pMonsterName = player->pName; // "%s stuns %s"
5566 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[635], pPlayer->pName, pMonster); 5577 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[635], player->pName, pMonster);
5567 ShowStatusBarString(pTmpBuf, 2u); 5578 ShowStatusBarString(pTmpBuf, 2u);
5568 } 5579 }
5569 } 5580 }
5570 if ( v53 != v41 ) 5581 if ( hit_will_paralyze != v41 )
5571 { 5582 {
5572 if ( pMonster->CanAct() ) 5583 if ( pMonster->CanAct() )
5573 { 5584 {
5574 if ( stru_50C198.GetMagicalResistance(pMonster, 3u) ) 5585 if ( stru_50C198.GetMagicalResistance(pMonster, 3) )
5575 { 5586 {
5576 LOBYTE(v43) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE); 5587 LOBYTE(v43) = player->GetActualSkillLevel(PLAYER_SKILL_MACE);
5577 v44 = v43; 5588 v44 = v43;
5578 v45 = SkillToMastery(v43); 5589 v45 = SkillToMastery(v43);
5579 v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F)); 5590 //v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F));
5580 v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v51 * 0.033333335); 5591 v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(7680 * (v44 & 0x3F)) * 0.033333335);
5581 pMonster->pActorBuffs[6].Apply(v46, v45, 0, 0, 0); 5592 pMonster->pActorBuffs[6].Apply(v46, v45, 0, 0, 0);
5582 if ( bShowDamage ) 5593 if ( bShowDamage )
5583 { 5594 {
5584 v50 = (int)pMonster; 5595 v50 = (int)pMonster;
5585 pMonsterName = pPlayer->pName; // "%s paralyzes %s" 5596 pMonsterName = player->pName; // "%s paralyzes %s"
5586 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[636], pPlayer->pName, pMonster); 5597 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[636], player->pName, pMonster);
5587 ShowStatusBarString(pTmpBuf, 2u); 5598 ShowStatusBarString(pTmpBuf, 2u);
5588 } 5599 }
5589 } 5600 }
5590 } 5601 }
5591 } 5602 }
5881 } 5892 }
5882 viewparams->bRedrawGameUI = 1; 5893 viewparams->bRedrawGameUI = 1;
5883 return; 5894 return;
5884 } 5895 }
5885 v37 = &pLayingItems[uActorID]; 5896 v37 = &pLayingItems[uActorID];
5886 v38 = v37->field_58 & 7; 5897 v38 = v37->field_58_pid & 7;
5887 v39 = v37->field_58 >> 3; 5898 v39 = v37->field_58_pid >> 3;
5888 v40 = v37->field_58 & 7; 5899 v40 = v37->field_58_pid & 7;
5889 uActorID = v37->field_58 >> 3; 5900 uActorID = v37->field_58_pid >> 3;
5890 v41 = v40 - 2; 5901 v41 = v40 - 2;
5891 if ( !v41 ) 5902 if ( !v41 )
5892 goto LABEL_80; 5903 goto LABEL_80;
5893 v42 = v41 - 1; 5904 v42 = v41 - 1;
5894 if ( !v42 ) 5905 if ( !v42 )
6070 if ( a4 != -1 ) 6081 if ( a4 != -1 )
6071 { 6082 {
6072 v43 = &pParty->pPlayers[a4]; 6083 v43 = &pParty->pPlayers[a4];
6073 LABEL_168: 6084 LABEL_168:
6074 a4b = v43; 6085 a4b = v43;
6075 if ( v38 != 4 || v37->field_48 != 100 ) 6086 if ( v38 != OBJECT_Player || v37->field_48 != 100 )
6076 { 6087 {
6077 v70 = v43->GetMaxHealth(); 6088 v70 = v43->GetMaxHealth();
6078 v68 = _43AFE3_calc_spell_damage(v37->field_48, v37->field_4C, v37->field_50, v70); 6089 v68 = _43AFE3_calc_spell_damage(v37->field_48, v37->field_4C, v37->field_50, v70);
6079 v69 = LOBYTE(pSpellStats->pInfos[v37->field_48].uSchool); 6090 v69 = LOBYTE(pSpellStats->pInfos[v37->field_48].uSchool);
6080 } 6091 }
6082 { 6093 {
6083 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); 6094 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0);
6084 v69 = 0; 6095 v69 = 0;
6085 } 6096 }
6086 a4b->ReceiveDamage(v68, v69); 6097 a4b->ReceiveDamage(v68, v69);
6087 if ( v38 == 4 && !qword_A750D8 ) 6098 if ( v38 == OBJECT_Player && !qword_A750D8 )
6088 { 6099 {
6089 qword_A750D8 = 256i64; 6100 qword_A750D8 = 256i64;
6090 word_A750E0 = 44; 6101 word_A750E0 = 44;
6091 word_A750E2 = uActorID + 1; 6102 word_A750E2 = uActorID + 1;
6092 } 6103 }
6122 unsigned int v6; // [sp+10h] [bp-4h]@1 6133 unsigned int v6; // [sp+10h] [bp-4h]@1
6123 6134
6124 v6 = uLayingItemID; 6135 v6 = uLayingItemID;
6125 v2 = uLayingItemID; 6136 v2 = uLayingItemID;
6126 v3 = a2 >> 3; 6137 v3 = a2 >> 3;
6127 v4 = pLayingItems[uLayingItemID].field_58 & 7; 6138 v4 = pLayingItems[uLayingItemID].field_58_pid & 7;
6128 v5 = (a2 & 7) - 3; 6139 v5 = (a2 & 7) - 3;
6129 if ( v5 ) 6140 if ( v5 )
6130 { 6141 {
6131 if ( v5 == 1 ) 6142 if ( v5 == 1 )
6132 { 6143 {
6294 int a2a; // [sp+Ch] [bp-4h]@8 6305 int a2a; // [sp+Ch] [bp-4h]@8
6295 6306
6296 uActorIDa = uActorID; 6307 uActorIDa = uActorID;
6297 pActor = &pActors[uActorID]; 6308 pActor = &pActors[uActorID];
6298 a2 = uObjID; 6309 a2 = uObjID;
6299 if ( !pActors[uActorID].IsAlive() ) 6310 if ( !pActors[uActorID].IsNotAlive() )
6300 { 6311 {
6301 if ( (a2 & 7) == OBJECT_Item) 6312 if ( (a2 & 7) == OBJECT_Item)
6302 { 6313 {
6303 v4 = &pLayingItems[(signed int)a2 >> 3]; 6314 v4 = &pLayingItems[(signed int)a2 >> 3];
6304 v5 = v4->field_48; 6315 v5 = v4->field_48;
6359 v17 = a1; 6370 v17 = a1;
6360 if ( (a1 & 7) == OBJECT_Item) 6371 if ( (a1 & 7) == OBJECT_Item)
6361 { 6372 {
6362 v5 = &pLayingItems[a1 >> 3]; 6373 v5 = &pLayingItems[a1 >> 3];
6363 v4 = v5->field_60_distance_related_prolly_lod; 6374 v4 = v5->field_60_distance_related_prolly_lod;
6364 v17 = v5->field_58; 6375 v17 = v5->field_58_pid;
6365 } 6376 }
6366 LOWORD(v6) = v17 & 7; 6377 LOWORD(v6) = v17 & 7;
6367 if ( v6 == 3 ) 6378 if ( v6 == OBJECT_Actor)
6368 { 6379 {
6369 v7 = &pActors[a2]; 6380 v7 = &pActors[a2];
6370 v8 = &pActors[v17 >> 3]; 6381 v8 = &pActors[v17 >> 3];
6371 v6 = pActors[a2].IsAlive(); 6382 v6 = pActors[a2].IsNotAlive();
6372 if ( !v6 ) 6383 if ( !v6 )
6373 { 6384 {
6374 v9 = v7->uAIState == 7; 6385 v9 = v7->uAIState == 7;
6375 v7->uLastCharacterIDToHit = v17; 6386 v7->uLastCharacterIDToHit = v17;
6376 if ( v9 ) 6387 if ( v9 )
12086 { 12097 {
12087 v6 = v5->uAttributes; 12098 v6 = v5->uAttributes;
12088 if ( (v6 & 0x100000) == v8 ) 12099 if ( (v6 & 0x100000) == v8 )
12089 { 12100 {
12090 ++*v1; 12101 ++*v1;
12091 if ( v5->IsAlive() == 1 ) 12102 if ( v5->IsNotAlive() == 1 )
12092 ++v3; 12103 ++v3;
12093 } 12104 }
12094 ++v4; 12105 ++v4;
12095 ++v5; 12106 ++v5;
12096 } 12107 }
12125 if ( (v5 & 0x100000) == v8 ) 12136 if ( (v5 & 0x100000) == v8 )
12126 { 12137 {
12127 if ( v4->pMonsterInfo.field_33 == v7 ) 12138 if ( v4->pMonsterInfo.field_33 == v7 )
12128 { 12139 {
12129 ++*v2; 12140 ++*v2;
12130 if ( v4->IsAlive() == 1 ) 12141 if ( v4->IsNotAlive() == 1 )
12131 ++v9; 12142 ++v9;
12132 } 12143 }
12133 } 12144 }
12134 ++v3; 12145 ++v3;
12135 ++v4; 12146 ++v4;
12165 if ( (v5 & 0x100000) == v8 ) 12176 if ( (v5 & 0x100000) == v8 )
12166 { 12177 {
12167 if ( v4->uGroup == v7 ) 12178 if ( v4->uGroup == v7 )
12168 { 12179 {
12169 ++*v2; 12180 ++*v2;
12170 if ( v4->IsAlive() == 1 ) 12181 if ( v4->IsNotAlive() == 1 )
12171 ++v9; 12182 ++v9;
12172 } 12183 }
12173 } 12184 }
12174 ++v3; 12185 ++v3;
12175 ++v4; 12186 ++v4;
12195 *v3 = 0; 12206 *v3 = 0;
12196 v6 = pActors[v2].uAttributes; 12207 v6 = pActors[v2].uAttributes;
12197 if ( (v6 & 0x100000) == v4 ) 12208 if ( (v6 & 0x100000) == v4 )
12198 { 12209 {
12199 *v3 = 1; 12210 *v3 = 1;
12200 if ( pActors[v2].IsAlive() == 1 ) 12211 if ( pActors[v2].IsNotAlive() == 1 )
12201 v5 = 1; 12212 v5 = 1;
12202 } 12213 }
12203 return v5; 12214 return v5;
12204 } 12215 }
12205 12216