Mercurial > mm7
comparison Indoor.cpp @ 2338:1e865e8690ba
Moving some function declarations from unsorted subs to Actor.h and SpriteObject.h
author | Grumpy7 |
---|---|
date | Sat, 05 Apr 2014 20:27:09 +0200 |
parents | d6887ee81068 |
children | 4100fb5c4913 |
comparison
equal
deleted
inserted
replaced
2337:d04017f3d2fa | 2338:1e865e8690ba |
---|---|
3128 Error("Attempt to open new level before clearing old"); | 3128 Error("Attempt to open new level before clearing old"); |
3129 if ( v4 == 3 ) | 3129 if ( v4 == 3 ) |
3130 Error("Out of memory loading indoor level"); | 3130 Error("Out of memory loading indoor level"); |
3131 if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) ) | 3131 if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) ) |
3132 { | 3132 { |
3133 InitializeActors(); | 3133 Actor::InitializeActors(); |
3134 InitializeSpriteObjects(); | 3134 SpriteObject::InitializeSpriteObjects(); |
3135 } | 3135 } |
3136 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000; | 3136 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000; |
3137 if ( !map_id ) | 3137 if ( !map_id ) |
3138 pDest = 0; | 3138 pDest = 0; |
3139 if ( pDest == 1 ) | 3139 if ( pDest == 1 ) |
3541 *pFaceID = blv_floor_id[i]; | 3541 *pFaceID = blv_floor_id[i]; |
3542 } | 3542 } |
3543 } | 3543 } |
3544 | 3544 |
3545 return result; | 3545 return result; |
3546 } | |
3547 //----- (004016FA) -------------------------------------------------------- | |
3548 int MakeActorAIList_BLV() | |
3549 { | |
3550 //Actor *v0; // esi@2 | |
3551 int v1; // eax@4 | |
3552 // int v2; // ebx@4 | |
3553 // unsigned int v3; // ecx@4 | |
3554 // int v4; // edx@5 | |
3555 // int v5; // edx@7 | |
3556 // unsigned int v6; // edx@9 | |
3557 unsigned int v7; // ST24_4@10 | |
3558 // int v8; // eax@10 | |
3559 int v9; // edi@10 | |
3560 // int v10; // ebx@14 | |
3561 // char v11; // zf@16 | |
3562 int v12; // eax@22 | |
3563 int v13; // edx@24 | |
3564 // int v14; // ecx@25 | |
3565 int v15; // ebx@26 | |
3566 // unsigned int *v16; // ecx@27 | |
3567 unsigned int v17; // esi@27 | |
3568 int v18; // ecx@31 | |
3569 signed int v19; // edi@31 | |
3570 // Actor *v20; // esi@32 | |
3571 // bool v21; // eax@33 | |
3572 // int v22; // eax@34 | |
3573 // signed int v23; // ebx@36 | |
3574 // Actor *v24; // esi@37 | |
3575 signed int v25; // eax@40 | |
3576 // int v26; // eax@43 | |
3577 int v27; // ebx@45 | |
3578 int j; // edi@45 | |
3579 // unsigned int v29; // eax@46 | |
3580 int v30; // eax@48 | |
3581 // int v31; // ecx@51 | |
3582 // int v32; // eax@51 | |
3583 // signed int v33; // eax@53 | |
3584 // __int64 v34; // qax@55 | |
3585 // char *v35; // ecx@56 | |
3586 int v37; // [sp+Ch] [bp-18h]@1 | |
3587 int v38; // [sp+10h] [bp-14h]@4 | |
3588 int v39; // [sp+14h] [bp-10h]@4 | |
3589 //int v40; // [sp+18h] [bp-Ch]@10 | |
3590 // int v41; // [sp+18h] [bp-Ch]@29 | |
3591 int i; // [sp+18h] [bp-Ch]@31 | |
3592 //signed int v43; // [sp+1Ch] [bp-8h]@1 | |
3593 // signed int v44; // [sp+1Ch] [bp-8h]@25 | |
3594 int v45; // [sp+20h] [bp-4h]@1 | |
3595 | |
3596 // __debugbreak(); // refactor for blv ai | |
3597 pParty->uFlags &= 0xFFFFFFCFu; | |
3598 v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
3599 v45 = 0; | |
3600 for ( uint i = 0; i < (signed int)uNumActors; ++i ) | |
3601 { | |
3602 pActors[i].uAttributes &= 0xFB00; | |
3603 if ( !pActors[i].CanAct() ) | |
3604 { | |
3605 pActors[i].uAttributes &= 0xBF00; | |
3606 continue; | |
3607 } | |
3608 v39 = abs(pParty->vPosition.z - pActors[i].vPosition.z); | |
3609 v38 = abs(pParty->vPosition.y - pActors[i].vPosition.y); | |
3610 v1 = abs(pParty->vPosition.x - pActors[i].vPosition.x); | |
3611 v7 = int_get_vector_length(v39, v38, v1); | |
3612 v9 = v7 - pActors[i].uActorRadius; | |
3613 if ( v9 < 0 ) | |
3614 v9 = 0; | |
3615 if ( v9 < 10240 ) | |
3616 { | |
3617 pActors[i].uAttributes &= 0xFEFFFFFF; | |
3618 if ( pActors[i].uAttributes & 0x80000 || pActors[i].GetActorsRelation(0) ) | |
3619 { | |
3620 pActors[i].uAttributes |= 0x1000000; | |
3621 if ( !(pParty->uFlags & 0x10) && (double)v9 < 307.2 ) | |
3622 pParty->uFlags |= 0x10; | |
3623 if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) | |
3624 pParty->uFlags |= 0x20; | |
3625 } | |
3626 v12 = v45++; | |
3627 ai_near_actors_distances[v12] = v9; | |
3628 ai_near_actors_ids[v12] = i; | |
3629 } | |
3630 else | |
3631 pActors[i].uAttributes &= 0xBF00; | |
3632 } | |
3633 v13 = 0; | |
3634 if ( v45 > 0 ) | |
3635 { | |
3636 for ( uint i = 1; i < v45; i++ ) | |
3637 { | |
3638 for ( uint j = 1; j < v45; ++j ) | |
3639 { | |
3640 v15 = ai_near_actors_distances[v13]; | |
3641 if ( ai_near_actors_distances[v13] > ai_near_actors_distances[j] ) | |
3642 { | |
3643 v17 = ai_near_actors_ids[v13]; | |
3644 ai_near_actors_ids[v13] = ai_near_actors_ids[j]; | |
3645 ai_near_actors_ids[j] = v17; | |
3646 ai_near_actors_distances[v13] = ai_near_actors_distances[j]; | |
3647 ai_near_actors_distances[j] = v15; | |
3648 } | |
3649 } | |
3650 ++v13; | |
3651 } | |
3652 } | |
3653 v18 = 0; | |
3654 v19 = 0; | |
3655 for ( i = 0; i < v45; i++ ) | |
3656 { | |
3657 if ( pActors[ai_near_actors_ids[i]].uAttributes & 0x8000 | |
3658 || sub_4070EF_prolly_detect_player(PID(OBJECT_Actor,ai_near_actors_ids[i]), 4) ) | |
3659 { | |
3660 pActors[ai_near_actors_ids[i]].uAttributes |= 0x8000; | |
3661 ai_array_4F6638_actor_ids[v19] = ai_near_actors_ids[i]; | |
3662 ai_array_4F5E68[v19++] = ai_near_actors_distances[i]; | |
3663 if ( v19 >= 30 ) | |
3664 break; | |
3665 } | |
3666 } | |
3667 ai_arrays_size = v19; | |
3668 if ( (signed int)uNumActors > 0 ) | |
3669 { | |
3670 for ( uint i = 0; i < (signed int)uNumActors; ++i ) | |
3671 { | |
3672 if ( pActors[i].CanAct() && pActors[i].uSectorID == v37 ) | |
3673 { | |
3674 v25 = 0; | |
3675 if ( v19 <= 0 ) | |
3676 { | |
3677 pActors[i].uAttributes |= 0x4000; | |
3678 ai_array_4F6638_actor_ids[ai_arrays_size++] = i; | |
3679 } | |
3680 else | |
3681 { | |
3682 while ( ai_array_4F6638_actor_ids[v25] != i ) | |
3683 { | |
3684 ++v25; | |
3685 if ( v25 >= v19 ) | |
3686 { | |
3687 pActors[i].uAttributes |= 0x4000; | |
3688 ai_array_4F6638_actor_ids[ai_arrays_size++] = i; | |
3689 break; | |
3690 } | |
3691 } | |
3692 } | |
3693 } | |
3694 } | |
3695 } | |
3696 v27 = ai_arrays_size; | |
3697 for ( j = 0; j < v45; ++j ) | |
3698 { | |
3699 //v29 = ai_near_actors_ids[j]; | |
3700 if ( pActors[ai_near_actors_ids[j]].uAttributes & 0xC000 && pActors[ai_near_actors_ids[j]].CanAct() ) | |
3701 { | |
3702 v30 = 0; | |
3703 if ( v27 <= 0 ) | |
3704 ai_array_4F6638_actor_ids[ai_arrays_size++] = ai_near_actors_ids[j]; | |
3705 else | |
3706 { | |
3707 while ( ai_array_4F6638_actor_ids[v30] != ai_near_actors_ids[j] ) | |
3708 { | |
3709 ++v30; | |
3710 if ( v30 >= v27 ) | |
3711 { | |
3712 ai_array_4F6638_actor_ids[ai_arrays_size++] = ai_near_actors_ids[j]; | |
3713 break; | |
3714 } | |
3715 } | |
3716 } | |
3717 } | |
3718 } | |
3719 if ( ai_arrays_size > 30 ) | |
3720 ai_arrays_size = 30; | |
3721 memcpy(ai_near_actors_ids.data(), ai_array_4F6638_actor_ids.data(), 4 * ai_arrays_size); | |
3722 memcpy(ai_near_actors_distances.data(), ai_array_4F5E68.data(), 4 * ai_arrays_size); | |
3723 for ( uint i = 0; i < ai_arrays_size; i++ ) | |
3724 pActors[ai_near_actors_ids[i]].uAttributes |= 0x400; | |
3725 return ai_arrays_size; | |
3726 } | 3546 } |
3727 //----- (0043FDED) -------------------------------------------------------- | 3547 //----- (0043FDED) -------------------------------------------------------- |
3728 void PrepareActorRenderList_BLV() | 3548 void PrepareActorRenderList_BLV() |
3729 { | 3549 { |
3730 // unsigned __int16 v3; // ax@3 | 3550 // unsigned __int16 v3; // ax@3 |