changeset 863:b7b67485ec43

* AI fixed * some PID_ID replaces
author zipi
date Sun, 31 Mar 2013 17:40:31 +0100
parents f4394e320312
children 0b4fc79351b6
files Actor.cpp mm7_3.cpp
diffstat 2 files changed, 25 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sun Mar 31 13:20:58 2013 +0100
+++ b/Actor.cpp	Sun Mar 31 17:40:31 2013 +0100
@@ -1906,6 +1906,7 @@
 		  v29 = pParty->sEyelevel;
 		v28 = pParty->vPosition.z + v29;
 		a4 = v28;
+		break;
 		}
 	case OBJECT_Decoration:
 		{
--- a/mm7_3.cpp	Sun Mar 31 13:20:58 2013 +0100
+++ b/mm7_3.cpp	Sun Mar 31 17:40:31 2013 +0100
@@ -15105,8 +15105,8 @@
 	char v35; // al@150
 	unsigned int v36; // edi@152
 	signed int v37; // eax@154
-	unsigned __int8 v38; // sf@158
-	unsigned __int8 v39; // of@158
+	//unsigned __int8 v38; // sf@158
+	//unsigned __int8 v39; // of@158
 	//signed int v40; // edx@166
 	//unsigned int v41; // ecx@166
 	double v42; // st7@176
@@ -15154,6 +15154,7 @@
 	unsigned int v84; // [sp+A8h] [bp-8h]@11
 	signed int target_pid; // [sp+ACh] [bp-4h]@83
 	AIState uAIState;
+	int v38;
 	
 	if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
 		MakeActorAIList_ODM();
@@ -15280,7 +15281,7 @@
 			if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 )
 				actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
 			// not sure
-			else // if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 )
+			else  if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 )
 				actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType;
 			
 			if ((signed __int64)actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 
@@ -15367,7 +15368,7 @@
 			if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 )
 				v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
 			// not sure
-			else // if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 )
+			else if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 )
 				v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType;
 			if ( (signed __int64)v21->pActorBuffs[2].uExpireTime < 0 )
 			{
@@ -15384,7 +15385,7 @@
 			v21->uCurrentActionTime += pMiscTimer->uTimeElapsed;
 			if ( (signed int)v28 > 0 )
 				v21->pMonsterInfo.uRecoveryTime = v28 - v27;
-			if ( v21->pMonsterInfo.uRecoveryTime< 0 )
+			if ( v21->pMonsterInfo.uRecoveryTime < 0 )
 				v21->pMonsterInfo.uRecoveryTime = 0;
 			if ( !(v21->uAttributes & 0x8000) )
 				v21->uAttributes |= 0x8000;
@@ -15463,22 +15464,26 @@
 				{
 					v37 = 4;
 				}
+				v38=0;
 				if ( v37 == 2 )
 				{
-					v39 = __OFSUB__(v36, 1024);
-					v38 = ((v36 - 1024) & 0x80000000u) != 0;
+					//v39 = __OFSUB__(v36, 1024);
+					//v38 = ((v36 - 1024) & 0x80000000u) != 0;
+					v38 = 1024;
 				}
 				else if ( v37 == 3 )
 				{
-					v39 = __OFSUB__(v36, 2560);
-					v38 = ((v36 - 2560) & 0x80000000u) != 0;
+					//v39 = __OFSUB__(v36, 2560);
+					//v38 = ((v36 - 2560) & 0x80000000u) != 0;
+					v38 = 2560;
 				}
 				else if ( v37 == 4 )
 				{
-					v39 = __OFSUB__(v36, 5120);
-					v38 = ((v36 - 5120) & 0x80000000u) != 0;
+					//v39 = __OFSUB__(v36, 5120);
+					//v38 = ((v36 - 5120) & 0x80000000u) != 0;
+					v38 = 5120;
 				}
-				if ( v37 >= 1 && v37 <= 4 && v38 ^ v39 || v37 == 1 )
+				if ( v37 >= 1 && v37 <= 4 && v36 < v38  || v37 == 1 )
 					v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
 			}
 
@@ -15497,7 +15502,7 @@
 				continue;
 			}
 
-			if ( /*v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long &&*/ target_pid ) // temporary
+			if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid )
 			{
 
 				if ( v21->pMonsterInfo.uAIType == 1 )
@@ -15562,9 +15567,11 @@
 								{
 									v64 = (signed __int64)v47;
 									Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
-									continue;
 								}
-								Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
+								else
+								{
+									Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
+								}
 							}
 						}
 						else
@@ -15929,7 +15936,7 @@
   result = v1->pQueue[0].uPackedID;
   if ( PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player)
   {
-    result = (result >> 3) + 1;
+    result = PID_ID(result) + 1;
     uActiveCharacter = result;
     v1->field_18 |= 4u;
   }
@@ -15945,7 +15952,7 @@
     do
     {
       if ( PID_TYPE(v17->uPackedID) == OBJECT_Player)
-        pParty->pPlayers[v17->uPackedID >> 3].uTimeToRecovery = (signed __int64)((double)v17->field_4 * 0.46875);
+        pParty->pPlayers[PID_ID(v17->uPackedID)].uTimeToRecovery = (signed __int64)((double)v17->field_4 * 0.46875);
       ++v22;
       ++v17;
       result = v22;