comparison mm7_5.cpp @ 82:1faa29fd4c2d

many type, memory, boundary fixes
author zipi
date Sun, 03 Feb 2013 23:37:17 +0000
parents 377535d6e366
children 98cd93e14777
comparison
equal deleted inserted replaced
81:377535d6e366 82:1faa29fd4c2d
12100 //----- (00408A7E) -------------------------------------------------------- 12100 //----- (00408A7E) --------------------------------------------------------
12101 unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID) 12101 unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID)
12102 { 12102 {
12103 unsigned int *v2; // esi@1 12103 unsigned int *v2; // esi@1
12104 signed int v3; // ebx@1 12104 signed int v3; // ebx@1
12105 char *v4; // edi@2 12105 Actor *v4; // edi@2
12106 int v5; // eax@3 12106 int v5; // eax@3
12107 int v7; // [sp+8h] [bp-Ch]@1 12107 int v7; // [sp+8h] [bp-Ch]@1
12108 int v8; // [sp+Ch] [bp-8h]@1 12108 int v8; // [sp+Ch] [bp-8h]@1
12109 unsigned int v9; // [sp+10h] [bp-4h]@1 12109 unsigned int v9; // [sp+10h] [bp-4h]@1
12110 12110
12114 v8 = GetAlertStatus(); 12114 v8 = GetAlertStatus();
12115 *v2 = 0; 12115 *v2 = 0;
12116 v9 = 0; 12116 v9 = 0;
12117 if ( (signed int)uNumActors > 0 ) 12117 if ( (signed int)uNumActors > 0 )
12118 { 12118 {
12119 v4 = (char *)&pActors[0].pMonsterInfo.uID; 12119 v4 = pActors;//[0].pMonsterInfo.uID;
12120 do 12120 do
12121 { 12121 {
12122 v5 = *((int *)v4 - 15); // actor::attributes 12122 v5 = v4->uAttributes; // actor::attributes
12123 if ( (v5 & 0x100000) == v8 ) 12123 if ( (v5 & 0x100000) == v8 )
12124 { 12124 {
12125 if ( *(short *)v4 - 1 == v7 ) 12125 if ( v4->pMonsterInfo.field_33 == v7 )
12126 { 12126 {
12127 ++*v2; 12127 ++*v2;
12128 if ( ((Actor *)(v4 - 96))->IsAlive() == 1 ) 12128 if ( v4->IsAlive() == 1 )
12129 ++v9; 12129 ++v9;
12130 } 12130 }
12131 } 12131 }
12132 ++v3; 12132 ++v3;
12133 v4 += 836; 12133 ++v4;
12134 } 12134 }
12135 while ( v3 < (signed int)uNumActors ); 12135 while ( v3 < (signed int)uNumActors );
12136 } 12136 }
12137 return v9; 12137 return v9;
12138 } 12138 }
12140 //----- (00408AE7) -------------------------------------------------------- 12140 //----- (00408AE7) --------------------------------------------------------
12141 unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup) 12141 unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup)
12142 { 12142 {
12143 unsigned int *v2; // esi@1 12143 unsigned int *v2; // esi@1
12144 signed int v3; // ebx@1 12144 signed int v3; // ebx@1
12145 char *v4; // edi@2 12145 Actor *v4; // edi@2
12146 int v5; // eax@3 12146 int v5; // eax@3
12147 unsigned int v7; // [sp+8h] [bp-Ch]@1 12147 unsigned int v7; // [sp+8h] [bp-Ch]@1
12148 int v8; // [sp+Ch] [bp-8h]@1 12148 int v8; // [sp+Ch] [bp-8h]@1
12149 unsigned int v9; // [sp+10h] [bp-4h]@1 12149 unsigned int v9; // [sp+10h] [bp-4h]@1
12150 12150
12154 v8 = GetAlertStatus(); 12154 v8 = GetAlertStatus();
12155 *v2 = 0; 12155 *v2 = 0;
12156 v9 = 0; 12156 v9 = 0;
12157 if ( (signed int)uNumActors > 0 ) 12157 if ( (signed int)uNumActors > 0 )
12158 { 12158 {
12159 v4 = (char *)&pActors[0].uGroup; 12159 v4 = pActors;//[0].uGroup;
12160 do 12160 do
12161 { 12161 {
12162 v5 = *((int *)v4 - 168); 12162 v5 = v4->uAttributes;
12163 if ( (v5 & 0x100000) == v8 ) 12163 if ( (v5 & 0x100000) == v8 )
12164 { 12164 {
12165 if ( *(int *)v4 == v7 ) 12165 if ( v4->uGroup == v7 )
12166 { 12166 {
12167 ++*v2; 12167 ++*v2;
12168 if ( ((Actor *)(v4 - 708))->IsAlive() == 1 ) 12168 if ( v4->IsAlive() == 1 )
12169 ++v9; 12169 ++v9;
12170 } 12170 }
12171 } 12171 }
12172 ++v3; 12172 ++v3;
12173 v4 += 836; 12173 ++v4;
12174 } 12174 }
12175 while ( v3 < (signed int)uNumActors ); 12175 while ( v3 < (signed int)uNumActors );
12176 } 12176 }
12177 return v9; 12177 return v9;
12178 } 12178 }