# HG changeset patch # User Grumpy7 # Date 1382494152 25200 # Node ID 50d00b884765a56a9d4201d13d0936ba9de4ab38 # Parent c77935190b5118fd4de6d23f9865a47ddbbee5e4 SearchActorByID, SearchActorByGroup, SearchActorByMonsterID, SearchAliveActors changed if-do-whiles to fors diff -r c77935190b51 -r 50d00b884765 Actor.cpp --- a/Actor.cpp Tue Oct 22 18:55:37 2013 -0700 +++ b/Actor.cpp Tue Oct 22 19:09:12 2013 -0700 @@ -957,7 +957,6 @@ float v31; // st7@45 float v32; // st6@45 float v33; // st7@45 - AIDirection *result; // eax@48 Vec3_int_ v37; // [sp-10h] [bp-5Ch]@15 AIDirection v41; // [sp+14h] [bp-38h]@46 float outy2; // [sp+38h] [bp-14h]@33 @@ -2876,7 +2875,6 @@ int v45; // eax@192 unsigned __int8 v46; // cl@197 signed int v47; // st7@206 - AIDirection *v57; // eax@246 uint v58; // st7@246 unsigned int v65; // [sp-10h] [bp-C0h]@144 int v70; // [sp-10h] [bp-C0h]@213 @@ -3429,22 +3427,15 @@ //----- (00408B54) -------------------------------------------------------- unsigned int SearchActorByID(unsigned int *pTotalActors, unsigned int a2) { - unsigned int v2; // edi@1 - unsigned int *v3; // esi@1 int v4; // eax@1 unsigned int v5; // ebx@1 - unsigned int v6; // edx@1 - v2 = a2; - v3 = pTotalActors; v4 = GetAlertStatus(); - v5 = 0; - *v3 = 0; - v6 = pActors[v2].uAttributes; - if ( (v6 & 0x100000) == v4 ) + *pTotalActors = 0; + if ( (pActors[a2].uAttributes & 0x100000) == GetAlertStatus() ) { - *v3 = 1; - if ( pActors[v2].IsNotAlive() == 1 ) + *pTotalActors = 1; + if ( pActors[a2].IsNotAlive() == 1 ) v5 = 1; } return v5; @@ -3452,114 +3443,66 @@ //----- (00408AE7) -------------------------------------------------------- unsigned int SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup) { - unsigned int *v2; // esi@1 - signed int v3; // ebx@1 - Actor *v4; // edi@2 - int v5; // eax@3 - unsigned int v7; // [sp+8h] [bp-Ch]@1 int v8; // [sp+Ch] [bp-8h]@1 unsigned int v9; // [sp+10h] [bp-4h]@1 + Actor* v4; - v7 = uGroup; - v2 = pTotalActors; - v3 = 0; v8 = GetAlertStatus(); - *v2 = 0; + *pTotalActors = 0; v9 = 0; - if ( (signed int)uNumActors > 0 ) + for ( uint i = 0; i < uNumActors; i++) { - v4 = pActors.data();//[0].uGroup; - do + v4 = &pActors[i]; + if ( (v4->uAttributes & 0x100000) == v8 && v4->uGroup == uGroup) { - v5 = v4->uAttributes; - if ( (v5 & 0x100000) == v8 ) - { - if ( v4->uGroup == v7 ) - { - ++*v2; - if ( v4->IsNotAlive() == 1 ) - ++v9; - } - } - ++v3; - ++v4; + ++*pTotalActors; + if ( v4->IsNotAlive() == 1 ) + ++v9; } - while ( v3 < (signed int)uNumActors ); } return v9; } //----- (00408A7E) -------------------------------------------------------- unsigned int SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID) { - unsigned int *v2; // esi@1 - signed int v3; // ebx@1 Actor *v4; // edi@2 - int v5; // eax@3 - int v7; // [sp+8h] [bp-Ch]@1 int v8; // [sp+Ch] [bp-8h]@1 unsigned int v9; // [sp+10h] [bp-4h]@1 - v7 = uMonsterID; - v2 = pTotalActors; - v3 = 0; v8 = GetAlertStatus(); - *v2 = 0; + *pTotalActors = 0; v9 = 0; - if ( (signed int)uNumActors > 0 ) + for ( uint i = 0; i < uNumActors; i++) { - v4 = pActors.data();//[0].pMonsterInfo.uID; - do + v4 = &pActors[i]; + if ( (v4->uAttributes & 0x100000) == v8 && v4->pMonsterInfo.field_33 == uMonsterID) { - v5 = v4->uAttributes; // actor::attributes - if ( (v5 & 0x100000) == v8 ) - { - if ( v4->pMonsterInfo.field_33 == v7 ) - { - ++*v2; - if ( v4->IsNotAlive() == 1 ) - ++v9; - } - } - ++v3; - ++v4; + ++*pTotalActors; + if ( v4->IsNotAlive() == 1 ) + ++v9; } - while ( v3 < (signed int)uNumActors ); } return v9; } //----- (00408A27) -------------------------------------------------------- unsigned int SearchAliveActors(unsigned int *pTotalActors) { - unsigned int *v1; // esi@1 int v2; // eax@1 unsigned int v3; // ebp@1 - signed int v4; // ebx@1 Actor *v5; // edi@2 - unsigned int v6; // eax@3 - int v8; // [sp+Ch] [bp-4h]@1 - v1 = pTotalActors; v2 = GetAlertStatus(); v3 = 0; - v4 = 0; - *v1 = 0; - v8 = v2; - if ( (signed int)uNumActors > 0 ) + *pTotalActors = 0; + for ( uint i = 0; i < uNumActors; i++) { - v5 = pActors.data(); - do + v5 = &pActors[i]; + if ( (v5->uAttributes & 0x100000) == v2 ) { - v6 = v5->uAttributes; - if ( (v6 & 0x100000) == v8 ) - { - ++*v1; - if ( v5->IsNotAlive() == 1 ) - ++v3; - } - ++v4; - ++v5; + ++*pTotalActors; + if ( v5->IsNotAlive() == 1 ) + ++v3; } - while ( v4 < (signed int)uNumActors ); } return v3; }