Mercurial > mm7
comparison mm7_3.cpp @ 390:35a62d1948d4
More sound fixes
author | Nomad |
---|---|
date | Sat, 23 Feb 2013 08:27:32 +0200 |
parents | 243418228760 |
children | 86637e3f59a9 |
comparison
equal
deleted
inserted
replaced
389:e32950ebabb9 | 390:35a62d1948d4 |
---|---|
1163 _46EF01_collision_chech_player(0); | 1163 _46EF01_collision_chech_player(0); |
1164 _46ED8A_collide_against_layingItems(8 * v75 | 3); | 1164 _46ED8A_collide_against_layingItems(8 * v75 | 3); |
1165 v31 = 0; | 1165 v31 = 0; |
1166 for ( i = 0; v31 < ai_arrays_size; ++v31 ) | 1166 for ( i = 0; v31 < ai_arrays_size; ++v31 ) |
1167 { | 1167 { |
1168 v33 = ai_array_4F7DB0_actor_ids[v31]; | 1168 v33 = ai_near_actors_ids[v31]; |
1169 if ( v33 != v75 && _46DF1A_collide_against_actor(v33, 40) ) | 1169 if ( v33 != v75 && _46DF1A_collide_against_actor(v33, 40) ) |
1170 ++i; | 1170 ++i; |
1171 } | 1171 } |
1172 v71 = i > 1; | 1172 v71 = i > 1; |
1173 if ( stru_721530.field_7C < stru_721530.field_6C ) | 1173 if ( stru_721530.field_7C < stru_721530.field_6C ) |
17278 | 17278 |
17279 | 17279 |
17280 //----- (004014E6) -------------------------------------------------------- | 17280 //----- (004014E6) -------------------------------------------------------- |
17281 int __cdecl ODM_4014E6_AI() | 17281 int __cdecl ODM_4014E6_AI() |
17282 { | 17282 { |
17283 Actor *v0; // esi@2 | 17283 //Actor *v0; // esi@2 |
17284 int v1; // eax@4 | 17284 int v1; // eax@4 |
17285 int v2; // ebx@4 | 17285 int v2; // ebx@4 |
17286 unsigned int v3; // ecx@4 | 17286 unsigned int v3; // ecx@4 |
17287 int v4; // edx@5 | 17287 int v4; // edx@5 |
17288 int v5; // edx@7 | 17288 int v5; // edx@7 |
17289 unsigned int v6; // edx@9 | 17289 unsigned int v6; // edx@9 |
17290 unsigned int v7; // ST20_4@10 | 17290 unsigned int v7; // ST20_4@10 |
17291 int v8; // eax@10 | 17291 //int v8; // eax@10 |
17292 int v9; // edi@10 | 17292 int v9; // edi@10 |
17293 int v10; // ebx@14 | 17293 int v10; // ebx@14 |
17294 char v11; // zf@16 | 17294 //char v11; // zf@16 |
17295 int v12; // eax@22 | 17295 //int v12; // eax@22 |
17296 int result; // eax@24 | 17296 int result; // eax@24 |
17297 int v14; // edx@25 | 17297 int v14; // edx@25 |
17298 int v15; // ecx@25 | 17298 int v15; // ecx@25 |
17299 int v16; // ebx@26 | 17299 int v16; // ebx@26 |
17300 unsigned int *v17; // ecx@27 | 17300 unsigned int *v17; // ecx@27 |
17301 unsigned int v18; // esi@27 | 17301 unsigned int v18; // esi@27 |
17302 int i; // edx@33 | 17302 int i; // edx@33 |
17303 char *v20; // ecx@34 | 17303 char *v20; // ecx@34 |
17304 int v21; // [sp+Ch] [bp-14h]@4 | 17304 int v21; // [sp+Ch] [bp-14h]@4 |
17305 int v22; // [sp+10h] [bp-10h]@4 | 17305 int v22; // [sp+10h] [bp-10h]@4 |
17306 int v23; // [sp+14h] [bp-Ch]@10 | 17306 //int v23; // [sp+14h] [bp-Ch]@10 |
17307 int v24; // [sp+14h] [bp-Ch]@29 | 17307 int v24; // [sp+14h] [bp-Ch]@29 |
17308 signed int v25; // [sp+18h] [bp-8h]@1 | 17308 //signed int v25; // [sp+18h] [bp-8h]@1 |
17309 signed int v26; // [sp+18h] [bp-8h]@25 | 17309 signed int v26; // [sp+18h] [bp-8h]@25 |
17310 int v27; // [sp+1Ch] [bp-4h]@1 | 17310 int v27; // [sp+1Ch] [bp-4h]@1 |
17311 | 17311 |
17312 pParty->uFlags &= 0xFFFFFFCFu; | 17312 pParty->uFlags &= 0xFFFFFFCFu; |
17313 v27 = 0; | 17313 v27 = 0; |
17314 v25 = 0; | 17314 |
17315 if ( (signed int)uNumActors > 0 ) | 17315 //v25 = 0; |
17316 { | 17316 for (uint i = 0; i < uNumActors; ++i) |
17317 v0 = pActors;//[0].uAttributes; | 17317 { |
17318 do | 17318 auto actor = pActors + i; |
17319 { | 17319 //v0 = pActors;//[0].uAttributes; |
17320 //do | |
17321 //{ | |
17320 //*(char *)(v0 + 1) &= 0xFBu; | 17322 //*(char *)(v0 + 1) &= 0xFBu; |
17321 BYTE1(v0->uAttributes) &= 0xFBu; | 17323 actor->uAttributes &= 0xFFFFFBFF; |
17322 if ( ! v0->CanAct() ) | 17324 if (!actor->CanAct()) |
17323 goto LABEL_37; | 17325 { |
17324 v22 = abs(pParty->vPosition.z - v0->vPosition.z); | 17326 actor->uAttributes &= 0xFFFFBFFF; |
17325 v21 = abs(pParty->vPosition.y - v0->vPosition.y); | 17327 continue; |
17326 v1 = abs(pParty->vPosition.x - v0->vPosition.x); | 17328 } |
17329 | |
17330 v22 = abs(pParty->vPosition.z - actor->vPosition.z); | |
17331 v21 = abs(pParty->vPosition.y - actor->vPosition.y); | |
17332 v1 = abs(pParty->vPosition.x - actor->vPosition.x); | |
17327 v2 = v21; | 17333 v2 = v21; |
17328 v3 = v22; | 17334 v3 = v22; |
17329 if ( v1 < v21 ) | 17335 if ( v1 < v21 ) |
17330 { | 17336 { |
17331 v4 = v1; | 17337 v4 = v1; |
17343 v6 = v3; | 17349 v6 = v3; |
17344 v3 = v2; | 17350 v3 = v2; |
17345 v2 = v6; | 17351 v2 = v6; |
17346 } | 17352 } |
17347 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; | 17353 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; |
17348 v8 = v0->uActorRadius; | 17354 //v8 = actor->uActorRadius; |
17349 v9 = v7 - v8; | 17355 v9 = v7 - actor->uActorRadius; |
17350 v23 = v7 - v8; | 17356 //v23 = v7 - v8; |
17351 if ( v23 < 0 ) | 17357 if ( v9 < 0 ) |
17352 { | 17358 { |
17353 v9 = 0; | 17359 v9 = 0; |
17354 v23 = 0; | 17360 //v23 = 0; |
17355 } | 17361 } |
17356 if ( v9 < 5632 ) | 17362 |
17357 { | 17363 if (v9 < 5632) |
17358 v10 = v0->uAttributes & 0xFEFFFFFF; | 17364 { |
17359 v0->uAttributes = v10; | 17365 v10 = actor->uAttributes & 0xFEFFFFFF; |
17360 if ( v10 & 0x80000 || v0->GetActorsRelation(0) ) | 17366 actor->uAttributes = v10; |
17367 if ( v10 & 0x80000 || actor->GetActorsRelation(0) ) | |
17361 { | 17368 { |
17362 v11 = (pParty->uFlags & 0x10) == 0; | 17369 //v11 = (pParty->uFlags & 0x10) == 0; |
17363 v0->uAttributes = v10 | 0x1000000; | 17370 actor->uAttributes = v10 | 0x1000000; |
17364 if ( v11 && (double)v23 < 307.2 ) | 17371 if (v9 < 5120 ) |
17365 pParty->uFlags |= 0x10u; | 17372 pParty->SetYellowAlert(); |
17366 if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) | 17373 if (v9 < 307) |
17367 pParty->uFlags |= 0x20u; | 17374 pParty->SetRedAlert(); |
17368 } | 17375 } |
17369 BYTE1(v0->uAttributes) |= 0x40u; | 17376 actor->uAttributes |= 0x00004000; |
17370 v12 = v27++; | 17377 ai_near_actors_distances[v27] = v9; |
17371 ai_array_4F75E0[v12] = v9; | 17378 ai_near_actors_ids[v27++] = i; |
17372 ai_array_4F7DB0_actor_ids[v12] = v25; | |
17373 } | 17379 } |
17374 else | 17380 else |
17375 { | 17381 actor->uAttributes &= 0xFFFFBFFF; |
17376 LABEL_37: | 17382 } |
17377 BYTE1(v0->uAttributes) &= 0xBFu; | 17383 |
17378 } | |
17379 ++v25; | |
17380 ++v0; | |
17381 } | |
17382 while ( v25 < (signed int)uNumActors ); | |
17383 } | |
17384 result = v27; | 17384 result = v27; |
17385 if ( v27 > 0 ) | 17385 if ( v27 > 0 ) |
17386 { | 17386 { |
17387 v14 = 0; | 17387 v14 = 0; |
17388 v15 = 1; | 17388 v15 = 1; |
17392 while ( 1 ) | 17392 while ( 1 ) |
17393 { | 17393 { |
17394 v24 = v15; | 17394 v24 = v15; |
17395 if ( v15 >= result ) | 17395 if ( v15 >= result ) |
17396 break; | 17396 break; |
17397 v16 = ai_array_4F75E0[v14]; | 17397 v16 = ai_near_actors_distances[v14]; |
17398 if ( v16 > ai_array_4F75E0[v15] ) | 17398 if ( v16 > ai_near_actors_distances[v15] ) |
17399 { | 17399 { |
17400 v17 = &ai_array_4F7DB0_actor_ids[v15]; | 17400 v17 = &ai_near_actors_ids[v15]; |
17401 v18 = ai_array_4F7DB0_actor_ids[v14]; | 17401 v18 = ai_near_actors_ids[v14]; |
17402 ai_array_4F7DB0_actor_ids[v14] = *v17; | 17402 ai_near_actors_ids[v14] = *v17; |
17403 *v17 = v18; | 17403 *v17 = v18; |
17404 v15 = v24; | 17404 v15 = v24; |
17405 ai_array_4F75E0[v14] = ai_array_4F75E0[v24]; | 17405 ai_near_actors_distances[v14] = ai_near_actors_distances[v24]; |
17406 ai_array_4F75E0[v24] = v16; | 17406 ai_near_actors_distances[v24] = v16; |
17407 } | 17407 } |
17408 result = v27; | 17408 result = v27; |
17409 ++v15; | 17409 ++v15; |
17410 } | 17410 } |
17411 ++v14; | 17411 ++v14; |
17420 result = 30; | 17420 result = 30; |
17421 ai_arrays_size = 30; | 17421 ai_arrays_size = 30; |
17422 } | 17422 } |
17423 for ( i = 0; i < result; ++i ) | 17423 for ( i = 0; i < result; ++i ) |
17424 { | 17424 { |
17425 v20 = (char *)&pActors[ai_array_4F7DB0_actor_ids[i]].uAttributes; | 17425 v20 = (char *)&pActors[ai_near_actors_ids[i]].uAttributes; |
17426 v20[1] |= 4u; | 17426 v20[1] |= 4u; |
17427 } | 17427 } |
17428 return result; | 17428 return result; |
17429 } | 17429 } |
17430 // 4F75D8: using guessed type int ai_arrays_size; | 17430 // 4F75D8: using guessed type int ai_arrays_size; |
17534 pParty->uFlags |= 0x10u; | 17534 pParty->uFlags |= 0x10u; |
17535 if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) | 17535 if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) |
17536 pParty->uFlags |= 0x20u; | 17536 pParty->uFlags |= 0x20u; |
17537 } | 17537 } |
17538 v12 = v45++; | 17538 v12 = v45++; |
17539 ai_array_4F75E0[v12] = v9; | 17539 ai_near_actors_distances[v12] = v9; |
17540 ai_array_4F7DB0_actor_ids[v12] = v43; | 17540 ai_near_actors_ids[v12] = v43; |
17541 } | 17541 } |
17542 else | 17542 else |
17543 { | 17543 { |
17544 LABEL_60: | 17544 LABEL_60: |
17545 BYTE1(v0->uAttributes) &= 0xBFu; | 17545 BYTE1(v0->uAttributes) &= 0xBFu; |
17559 while ( 1 ) | 17559 while ( 1 ) |
17560 { | 17560 { |
17561 v41 = v14; | 17561 v41 = v14; |
17562 if ( v14 >= v45 ) | 17562 if ( v14 >= v45 ) |
17563 break; | 17563 break; |
17564 v15 = ai_array_4F75E0[v13]; | 17564 v15 = ai_near_actors_distances[v13]; |
17565 if ( v15 > ai_array_4F75E0[v14] ) | 17565 if ( v15 > ai_near_actors_distances[v14] ) |
17566 { | 17566 { |
17567 v16 = &ai_array_4F7DB0_actor_ids[v14]; | 17567 v16 = &ai_near_actors_ids[v14]; |
17568 v17 = ai_array_4F7DB0_actor_ids[v13]; | 17568 v17 = ai_near_actors_ids[v13]; |
17569 ai_array_4F7DB0_actor_ids[v13] = *v16; | 17569 ai_near_actors_ids[v13] = *v16; |
17570 *v16 = v17; | 17570 *v16 = v17; |
17571 v14 = v41; | 17571 v14 = v41; |
17572 ai_array_4F75E0[v13] = ai_array_4F75E0[v41]; | 17572 ai_near_actors_distances[v13] = ai_near_actors_distances[v41]; |
17573 ai_array_4F75E0[v41] = v15; | 17573 ai_near_actors_distances[v41] = v15; |
17574 } | 17574 } |
17575 ++v14; | 17575 ++v14; |
17576 } | 17576 } |
17577 ++v13; | 17577 ++v13; |
17578 v14 = v44 + 1; | 17578 v14 = v44 + 1; |
17582 } | 17582 } |
17583 v18 = 0; | 17583 v18 = 0; |
17584 v19 = 0; | 17584 v19 = 0; |
17585 for ( i = 0; v18 < v45; i = v18 ) | 17585 for ( i = 0; v18 < v45; i = v18 ) |
17586 { | 17586 { |
17587 v20 = &pActors[ai_array_4F7DB0_actor_ids[v18]]; | 17587 v20 = &pActors[ai_near_actors_ids[v18]]; |
17588 if ( v20->uAttributes & 0x8000 | 17588 if ( v20->uAttributes & 0x8000 |
17589 || (v21 = sub_4070EF_prolly_collide_objects(8 * ai_array_4F7DB0_actor_ids[v18] | 3, 4u), v18 = i, v21) ) | 17589 || (v21 = sub_4070EF_prolly_collide_objects(8 * ai_near_actors_ids[v18] | 3, 4u), v18 = i, v21) ) |
17590 { | 17590 { |
17591 v22 = ai_array_4F7DB0_actor_ids[v18]; | 17591 v22 = ai_near_actors_ids[v18]; |
17592 v20->uAttributes |= 0x8000u; | 17592 v20->uAttributes |= 0x8000u; |
17593 ai_array_4F6638_actor_ids[v19] = v22; | 17593 ai_array_4F6638_actor_ids[v19] = v22; |
17594 ai_array_4F5E68[v19++] = ai_array_4F75E0[v18]; | 17594 ai_array_4F5E68[v19++] = ai_near_actors_distances[v18]; |
17595 if ( v19 >= 30 ) | 17595 if ( v19 >= 30 ) |
17596 break; | 17596 break; |
17597 } | 17597 } |
17598 ++v18; | 17598 ++v18; |
17599 } | 17599 } |
17631 while ( v23 < (signed int)uNumActors ); | 17631 while ( v23 < (signed int)uNumActors ); |
17632 } | 17632 } |
17633 v27 = ai_arrays_size; | 17633 v27 = ai_arrays_size; |
17634 for ( j = 0; j < v45; ++j ) | 17634 for ( j = 0; j < v45; ++j ) |
17635 { | 17635 { |
17636 v29 = ai_array_4F7DB0_actor_ids[j]; | 17636 v29 = ai_near_actors_ids[j]; |
17637 if ( pActors[v29].uAttributes & 0xC000 && pActors[v29].CanAct() ) | 17637 if ( pActors[v29].uAttributes & 0xC000 && pActors[v29].CanAct() ) |
17638 { | 17638 { |
17639 v30 = 0; | 17639 v30 = 0; |
17640 if ( v27 <= 0 ) | 17640 if ( v27 <= 0 ) |
17641 { | 17641 { |
17642 LABEL_51: | 17642 LABEL_51: |
17643 v31 = ai_arrays_size; | 17643 v31 = ai_arrays_size; |
17644 v32 = ai_array_4F7DB0_actor_ids[j]; | 17644 v32 = ai_near_actors_ids[j]; |
17645 ++ai_arrays_size; | 17645 ++ai_arrays_size; |
17646 ai_array_4F6638_actor_ids[v31] = v32; | 17646 ai_array_4F6638_actor_ids[v31] = v32; |
17647 } | 17647 } |
17648 else | 17648 else |
17649 { | 17649 { |
17650 while ( ai_array_4F6638_actor_ids[v30] != ai_array_4F7DB0_actor_ids[j] ) | 17650 while ( ai_array_4F6638_actor_ids[v30] != ai_near_actors_ids[j] ) |
17651 { | 17651 { |
17652 ++v30; | 17652 ++v30; |
17653 if ( v30 >= v27 ) | 17653 if ( v30 >= v27 ) |
17654 goto LABEL_51; | 17654 goto LABEL_51; |
17655 } | 17655 } |
17660 if ( ai_arrays_size > 30 ) | 17660 if ( ai_arrays_size > 30 ) |
17661 { | 17661 { |
17662 v33 = 30; | 17662 v33 = 30; |
17663 ai_arrays_size = 30; | 17663 ai_arrays_size = 30; |
17664 } | 17664 } |
17665 memcpy(ai_array_4F7DB0_actor_ids, ai_array_4F6638_actor_ids, 4 * v33); | 17665 memcpy(ai_near_actors_ids, ai_array_4F6638_actor_ids, 4 * v33); |
17666 memcpy(ai_array_4F75E0, ai_array_4F5E68, 4 * ai_arrays_size); | 17666 memcpy(ai_near_actors_distances, ai_array_4F5E68, 4 * ai_arrays_size); |
17667 v34 = (unsigned int)ai_arrays_size; | 17667 v34 = (unsigned int)ai_arrays_size; |
17668 if ( ai_arrays_size > 0 ) | 17668 if ( ai_arrays_size > 0 ) |
17669 { | 17669 { |
17670 do | 17670 do |
17671 { | 17671 { |
17672 v35 = (char *)&pActors[ai_array_4F7DB0_actor_ids[HIDWORD(v34)]].uAttributes; | 17672 v35 = (char *)&pActors[ai_near_actors_ids[HIDWORD(v34)]].uAttributes; |
17673 v35[1] |= 4u; | 17673 v35[1] |= 4u; |
17674 ++HIDWORD(v34); | 17674 ++HIDWORD(v34); |
17675 } | 17675 } |
17676 while ( SHIDWORD(v34) < (signed int)v34 ); | 17676 while ( SHIDWORD(v34) < (signed int)v34 ); |
17677 } | 17677 } |
17933 v78 = 0; | 17933 v78 = 0; |
17934 if ( ai_arrays_size > 0 ) | 17934 if ( ai_arrays_size > 0 ) |
17935 { | 17935 { |
17936 while ( 1 ) | 17936 while ( 1 ) |
17937 { | 17937 { |
17938 uActorID = ai_array_4F7DB0_actor_ids[v78]; | 17938 uActorID = ai_near_actors_ids[v78]; |
17939 v20 = &dword_4F6E08[uActorID]; | 17939 v20 = &dword_4F6E08[uActorID]; |
17940 v21 = &pActors[uActorID]; | 17940 v21 = &pActors[uActorID]; |
17941 Actor::_401221(uActorID, &dword_4F6E08[uActorID], 1u); | 17941 Actor::_401221(uActorID, &dword_4F6E08[uActorID], 1u); |
17942 if ( v21->pMonsterInfo.uHostilityType && !*v20 ) | 17942 if ( v21->pMonsterInfo.uHostilityType && !*v20 ) |
17943 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 17943 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
18680 v35 = v1->uActorQueueSize; | 18680 v35 = v1->uActorQueueSize; |
18681 v4 = v35; | 18681 v4 = v35; |
18682 v40b = v35; | 18682 v40b = v35; |
18683 if ( v40b < v40b + ai_arrays_size ) | 18683 if ( v40b < v40b + ai_arrays_size ) |
18684 { | 18684 { |
18685 v34 = (int *)ai_array_4F7DB0_actor_ids; | 18685 v34 = (int *)ai_near_actors_ids; |
18686 do | 18686 do |
18687 { | 18687 { |
18688 v37 = *v34; | 18688 v37 = *v34; |
18689 v5 = v37; | 18689 v5 = v37; |
18690 v6 = &pActors[v37]; | 18690 v6 = &pActors[v37]; |