diff mm7_3.cpp @ 844:d593ca75c366

more UpdateActorAI cleaning 2
author zipi
date Fri, 29 Mar 2013 14:53:06 +0000
parents 292c6288204d
children 8f135b689262
line wrap: on
line diff
--- a/mm7_3.cpp	Fri Mar 29 13:52:55 2013 +0000
+++ b/mm7_3.cpp	Fri Mar 29 14:53:06 2013 +0000
@@ -15145,11 +15145,11 @@
 	double v56; // st7@226
 	AIDirection *v57; // eax@246
 	double v58; // st7@246
-	signed int v59; // [sp-18h] [bp-C8h]@213
+	//signed int v59; // [sp-18h] [bp-C8h]@213
 	//int v60; // [sp-14h] [bp-C4h]@144
 	//int v61; // [sp-14h] [bp-C4h]@168
-	AIDirection *v62; // [sp-14h] [bp-C4h]@213
-	signed int v63; // [sp-14h] [bp-C4h]@216
+	//AIDirection *v62; // [sp-14h] [bp-C4h]@213
+	//signed int v63; // [sp-14h] [bp-C4h]@216
 	unsigned int v64; // [sp-14h] [bp-C4h]@219
 	unsigned int v65; // [sp-10h] [bp-C0h]@144
 	char v66; // [sp-10h] [bp-C0h]@147
@@ -15507,6 +15507,7 @@
 				if ( v37 >= 1 && v37 <= 4 && v38 ^ v39 || v37 == 1 )
 					v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
 			}
+
 			if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 )
 			{
 				if ( (signed int)v36 >= 10240 )
@@ -15521,43 +15522,41 @@
 				}
 				continue;
 			}
+
 			if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && actor_pid )
 			{
-				if ( !(v21->uAttributes & 0x020000) || v21->pMonsterInfo.uAIType == 1 )
+
+				if ( v21->pMonsterInfo.uAIType == 1 )
 				{
-					if ( v21->pMonsterInfo.uAIType == 1 )
+					if ( v21->pMonsterInfo.uMovementType == 5 )
 					{
-						if ( v21->pMonsterInfo.uMovementType == 5 )
-						{
-							Actor::AI_Stand(actor_id, actor_pid, (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333),	&pDir);
-						}
-						else
-						{
-							Actor::_402968(actor_id, actor_pid, 0, &pDir);
-							continue;
-						}
-						
+						Actor::AI_Stand(actor_id, actor_pid, (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333),	&pDir);
 					}
 					else
 					{
+						Actor::_402968(actor_id, actor_pid, 0, &pDir);
+						continue;
+					}
+						
+				}
+				if ( !(v21->uAttributes & 0x020000) )
+				{
+					if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3)
+					{
+						if ( v21->pMonsterInfo.uAIType == 2 )
+							v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2;
+						if ( v21->pMonsterInfo.uAIType == 3 )
+							v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1;
 						v84 = v21->sCurrentHP;
 						v42 = (double)(signed int)v84;
-						if ( v21->pMonsterInfo.uAIType == 2 )
-						{
-	
-							v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2;
-						}
-						else
-						{
-							v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1;
-						}
-						if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3 && v43 > v42 && (signed int)v36 < 10240 )
+						if ( v43 > v42 && (signed int)v36 < 10240 )
 						{
 							Actor::_402968(actor_id, actor_pid, 0, &pDir);
 							continue;
 						}
 					}
 				}
+				
 				v81 = v36 - v21->uActorRadius;
 				if ( actor_pid_type == OBJECT_Actor )
 					v81 -= pActors[actor_pid >> 3].uActorRadius;
@@ -15568,107 +15567,109 @@
 				if ( v81 < 5120 )
 				{
 					v45 = stru_50C198.special_ability_use_check(v21, actor_id);
-					if ( !v45 )
+					if ( v45 == 0 )
 					{
 						if ( v21->pMonsterInfo.uMissleAttack1Type )
 						{
 							if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 )
 							{
 								Actor::_403476(actor_id, actor_pid, &pDir);
-								continue;
-								
 							}
-							if ( v21->pMonsterInfo.uMovementType == 5 )
-							{
-								v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
-								v64 = (signed __int64)v47;
-								Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-								continue;
-							}
-							v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
-							if ( !(v54 | v55) )
-							{
-								v64 = (signed __int64)v47;
-								Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-								continue;
-							}
-							Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir);
-							continue;
-						}
-						v56 = v80 * 307.2;
-						if ( (double)v81 >= v56 )
-						{
-							if ( v81 >= 1024 )
-							{
-								if ( v21->pMonsterInfo.uMovementType == 5 )
-								{
-									v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
-									v64 = (signed __int64)v47;
-									Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-									continue;
-								}
-								v63 = 0;
-								//monsters
-								Actor::_402686(actor_id, actor_pid, v63, &pDir);
-								continue;
-							}
-							if ( v21->pMonsterInfo.uMovementType == 5 )
+							else if ( v21->pMonsterInfo.uMovementType == 5 )
 							{
 								v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 								v64 = (signed __int64)v47;
 								Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-								continue;
 							}
-							v70 = (signed __int64)v56;
-							v62 = &pDir;
-							v59 = 0;
-							//monsters
-							//guard after player runs away
-							// follow player
-							Actor::_40281C(actor_id, actor_pid, v59, v62, v70);
-							continue;
-						}
-						if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
-						{
-							v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
-							v64 = (signed __int64)v47;
-							Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-							continue;
-						}
-						//monsters
-						Actor::_403C6C(actor_id, actor_pid, &pDir);
-						continue;
-					}
-					if ( v45 != 1 )
-					{
-						if ( v45 > 1 && v45 <= 3 )
-						{
-							if ( v45 == 2 )
-								v46 = v21->pMonsterInfo.uSpell1ID;
 							else
-								v46 = v21->pMonsterInfo.uSpell2ID;
-							if ( v46 )
 							{
-								if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 )
+								v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
+								if ( !(v54 | v55) )
 								{
-									if ( v45 == 2 )
-										Actor::_403854(actor_id, actor_pid, &pDir);
-									else
-										Actor::_403A60(actor_id, actor_pid, &pDir);
+									v64 = (signed __int64)v47;
+									Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
 									continue;
 								}
-								if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 )
+								Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir);
+							}
+						}
+						else
+						{
+							v56 = v80 * 307.2;
+							if ( (double)v81 >= v56 )
+							{
+								if ( v81 >= 1024 )
+								{
+									if ( v21->pMonsterInfo.uMovementType == 5 )
+									{
+										v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
+										v64 = (signed __int64)v47;
+										Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
+									}
+									else
+									{
+										//monsters
+										Actor::_402686(actor_id, actor_pid, 0, &pDir);
+									}
+								}
+								else if ( v21->pMonsterInfo.uMovementType == 5 )
 								{
 									v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 									v64 = (signed __int64)v47;
 									Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-									continue;
-									
+								}
+								else
+								{
+									v70 = (signed __int64)v56;
+									//monsters
+									//guard after player runs away
+									// follow player
+									Actor::_40281C(actor_id, actor_pid, 0, &pDir, v70);
 								}
+							}
+							else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
+							{
+								v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
+								v64 = (signed __int64)v47;
+								Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
+							}
+							else
+							{
+								//monsters
+								Actor::_403C6C(actor_id, actor_pid, &pDir);
+							}
+						}
+						continue;
+					}
+					else if ( v45 == 2 || v45 == 3 )
+					{
+						if ( v45 == 2 )
+							v46 = v21->pMonsterInfo.uSpell1ID;
+						else
+							v46 = v21->pMonsterInfo.uSpell2ID;
+						if ( v46 )
+						{
+							if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 )
+							{
+								if ( v45 == 2 )
+									Actor::_403854(actor_id, actor_pid, &pDir);
+								else
+									Actor::_403A60(actor_id, actor_pid, &pDir);
+							}
+							else if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 )
+							{
+								v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
+								v64 = (signed __int64)v47;
+								Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
+							}
+							else
+							{
 								v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 								Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir);
-								continue;
 							}
+						}
+						else
+						{
 							v48 = v80 * 307.2;
 							if ( (double)v81 >= v48 )
 							{
@@ -15684,59 +15685,54 @@
 									{
 										Actor::_402686(actor_id, actor_pid, 256, &pDir);
 									}
-									continue;
-									
 								}
-								if ( v21->pMonsterInfo.uMovementType == 5 )
+								else if ( v21->pMonsterInfo.uMovementType == 5 )
 								{
 									v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 									v64 = (signed __int64)v47;
 									Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-									continue;
 								}
-								v70 = (signed __int64)v48;
-								v62 = &pDir;
-								v59 = 0;
-								Actor::_40281C(actor_id, actor_pid, v59, v62, v70);
-								continue;
+								else
+								{
+									v70 = (signed __int64)v48;
+									Actor::_40281C(actor_id, actor_pid, 0, &pDir, v70);
+								}
 							}
-							if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
+							else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
 							{
 								v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 								v64 = (signed __int64)v47;
 								Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-								continue;
 							}
-							Actor::_403C6C(actor_id, actor_pid, &pDir);
-							continue;
+							else
+							{
+								Actor::_403C6C(actor_id, actor_pid, &pDir);
+							}
 						}
+						continue;
 					}
 				}
 			}
+
 			if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !actor_pid || v81 >= 5120 || v45 != 1 )
 			{
 				if ( !v21->pMonsterInfo.uMovementType )
 				{
 					Actor::_4032B2(actor_id, 4, 1024, 0);
-					continue;
-					
 				}
-				if ( v21->pMonsterInfo.uMovementType == 1 )
+				else if ( v21->pMonsterInfo.uMovementType == 1 )
 				{
 					Actor::_4032B2(actor_id, 4, 2560, 0);
-					continue;
 				}
-				if ( v21->pMonsterInfo.uMovementType == 2 )
+				else if ( v21->pMonsterInfo.uMovementType == 2 )
 				{
 					Actor::_4032B2(actor_id, 4, 5120, 0);
-					continue;
 				}
-				if ( v21->pMonsterInfo.uMovementType == 4 )
+				else if ( v21->pMonsterInfo.uMovementType == 4 )
 				{
 					Actor::_4032B2(actor_id, 4, 10240, 0);
-					continue;
 				}
-				if ( v21->pMonsterInfo.uMovementType == 5 )
+				else if ( v21->pMonsterInfo.uMovementType == 5 )
 				{
 					v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0);
 					v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
@@ -15744,12 +15740,9 @@
 					memcpy(&pDir, &v74, sizeof(pDir));
 					v64 = (signed __int64)v58;
 					Actor::AI_Stand(actor_id, 4, v64, &pDir);
-					continue;
-				}
-				continue;
-				
+				}				
 			}
-			if ( !v21->pMonsterInfo.uMissleAttack2Type )
+			else if ( !v21->pMonsterInfo.uMissleAttack2Type )
 			{
 				v56 = v80 * 307.2;
 				if ( (double)v81 >= v56 )
@@ -15761,49 +15754,52 @@
 							v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 							v64 = (signed __int64)v47;
 							Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-							continue;
 						}
-						v63 = 256;
-						Actor::_402686(actor_id, actor_pid, v63, &pDir);
-						continue;
+						else
+						{
+							Actor::_402686(actor_id, actor_pid, 256, &pDir);
+						}
 					}
-					if ( v21->pMonsterInfo.uMovementType == 5 )
+					else if ( v21->pMonsterInfo.uMovementType == 5 )
 					{
 						v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 						v64 = (signed __int64)v47;
 						Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-						continue;
 					}
-					v70 = (signed __int64)v56;
-					v62 = &pDir;
-					v59 = 0;
-					Actor::_40281C(actor_id, actor_pid, v59, v62, v70);
-					continue;
-					
+					else
+					{
+						v70 = (signed __int64)v56;
+						Actor::_40281C(actor_id, actor_pid, 0, &pDir, v70);
+					}
 				}
-				if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
+				else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
 				{
 					v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 					v64 = (signed __int64)v47;
 					Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-					continue;
 				}
-				Actor::_403C6C(actor_id, actor_pid, &pDir);
-				continue;
+				else
+				{
+					Actor::_403C6C(actor_id, actor_pid, &pDir);
+				}
 			}
-			if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
+			else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
 			{
 				v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 				if ( !(v54 | v55) || v21->pMonsterInfo.uMovementType == 5 )
 				{
 					v64 = (signed __int64)v47;
 					Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
-					continue;
+				}
+				else
+				{
+					Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir);
 				}
-				Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir);
-				continue;
 			}
-			Actor::_40368B(actor_id, actor_pid, &pDir);
+			else
+			{
+				Actor::_40368B(actor_id, actor_pid, &pDir);
+			}
 		}
 	}
 }