diff Actor.cpp @ 849:8fafe3645f36

* PID replaces * Actor::GetDirectionInfo cleaning
author zipi
date Sun, 31 Mar 2013 11:46:28 +0100
parents ceef50611567
children 48c230c37d74
line wrap: on
line diff
--- a/Actor.cpp	Sun Mar 31 10:44:43 2013 +0100
+++ b/Actor.cpp	Sun Mar 31 11:46:28 2013 +0100
@@ -781,7 +781,7 @@
             v24 = (double)v118;
             v118 = v23;
             v112 = v24;
-            v116 = 8 * LODWORD(v120) | 3;
+            v116 = PID(LODWORD(v120),OBJECT_Actor);
             do
             {
               v26 = rand();
@@ -915,7 +915,7 @@
             v102 = 0;
             v40 = 8 * LODWORD(v120);
             v101 = -1;
-            LOBYTE(v40) = 8 * LOBYTE(v120) | 3;
+            LOBYTE(v40) = PID(LOBYTE(v120),OBJECT_Actor);
             v100 = 0;
             v99 = v40;
             v98 = (SoundID)10040;
@@ -968,7 +968,7 @@
             v102 = 0;
             v43 = 8 * LODWORD(v120);
             v101 = -1;
-            LOBYTE(v43) = 8 * LOBYTE(v120) | 3;
+            LOBYTE(v43) = PID(LOBYTE(v120),OBJECT_Actor);
             v100 = 0;
             v99 = v43;
             v98 = (SoundID)14010;
@@ -1007,7 +1007,7 @@
             v102 = 0;
             v46 = 8 * LODWORD(v120);
             v101 = -1;
-            LOBYTE(v46) = 8 * LOBYTE(v120) | 3;
+            LOBYTE(v46) = PID(LOBYTE(v120),OBJECT_Actor);
             v100 = 0;
             v99 = v46;
             v98 = (SoundID)13040;
@@ -1050,7 +1050,7 @@
         v50 = 8 * LODWORD(v120);
         v102 = v47;
         v101 = -1;
-        LOBYTE(v50) = 8 * LOBYTE(v120) | 3;
+        LOBYTE(v50) = PID(LOBYTE(v120),OBJECT_Actor);
         v100 = v47;
         v99 = v50;
         v98 = (SoundID)14020;
@@ -1102,7 +1102,7 @@
       v65 = 8 * LODWORD(v120);
       v102 = 0;
       v101 = -1;
-      LOBYTE(v65) = 8 * LOBYTE(v120) | 3;
+      LOBYTE(v65) = PID(LOBYTE(v120),OBJECT_Actor);
       v100 = 0;
       v99 = v65;
       v22 = (SoundID)word_4EE088_sound_ids[80];
@@ -1131,7 +1131,7 @@
         v102 = 0;
         v52 = 8 * LODWORD(v120);
         v101 = -1;
-        LOBYTE(v52) = 8 * LOBYTE(v120) | 3;
+        LOBYTE(v52) = PID(LOBYTE(v120),OBJECT_Actor);
         v100 = 0;
         v99 = v52;
         v98 = (SoundID)16060;
@@ -1185,7 +1185,7 @@
         v102 = 0;
         v55 = 8 * LODWORD(v120);
         v101 = -1;
-        LOBYTE(v55) = 8 * LOBYTE(v120) | 3;
+        LOBYTE(v55) = PID(LOBYTE(v120),OBJECT_Actor);
         v100 = 0;
         v99 = v55;
         v98 = (SoundID)14060;
@@ -1228,7 +1228,7 @@
         v102 = 0;
         v97 = 8 * LODWORD(v120);
         v101 = -1;
-        LOBYTE(v97) = 8 * LOBYTE(v120) | 3;
+        LOBYTE(v97) = PID(LOBYTE(v120),OBJECT_Actor);
         v100 = 0;
         v99 = v97;
         v98 = (SoundID)17070;
@@ -1272,7 +1272,7 @@
         v102 = 0;
         v95 = 8 * LODWORD(v120);
         v101 = -1;
-        LOBYTE(v95) = 8 * LOBYTE(v120) | 3;
+        LOBYTE(v95) = PID(LOBYTE(v120),OBJECT_Actor);
         v100 = 0;
         v99 = v95;
         v98 = (SoundID)17080;
@@ -1319,7 +1319,7 @@
         v102 = 0;
         v69 = 8 * LODWORD(v120);
         v101 = -1;
-        LOBYTE(v69) = 8 * LOBYTE(v120) | 3;
+        LOBYTE(v69) = PID(LOBYTE(v120),OBJECT_Actor);
         v100 = 0;
         v99 = v69;
         v98 = (SoundID)18060;
@@ -1758,173 +1758,160 @@
   float a4a; // [sp+58h] [bp+Ch]@45
 
   v4 = PID_ID(uObj1ID);
-  v5 = PID_TYPE(uObj1ID) - 2;
+  v5 = PID_TYPE(uObj1ID);
   v6 = uObj2ID;
-  if ( !v5 )
-  {
-    v19 = v4;
-    outx = pSpriteObjects[v19].vPosition.x;
-    v13 = pSpriteObjects[v19].vPosition.y;
-    v14 = pSpriteObjects[v19].vPosition.z;
-    goto LABEL_26;
-  }
-  v7 = v5 - 1;
-  if ( !v7 )
-  {
-    outx = pActors[v4].vPosition.x;
-    outy = pActors[v4].vPosition.y;
-    LODWORD(v42) = pActors[v4].uActorHeight;
-    v11 = pActors[v4].vPosition.z - (unsigned int)(signed __int64)((double)SLODWORD(v42) * -0.75);
-    goto LABEL_24;
-  }
-  v8 = v7 - 1;
-  if ( !v8 )
-  {
-    if ( !v4 )
-    {
-      outx = pParty->vPosition.x;
-      outy = pParty->vPosition.y;
-      v14 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
-LABEL_27:
-      outz = v14;
-      goto LABEL_28;
-    }
-    v15 = v4 - 1;
-    if ( v15 )
-    {
-      v16 = v15 - 1;
-      if ( v16 )
-      {
-        v17 = v16 - 1;
-        if ( v17 )
-        {
-          if ( v17 != 1 )
-            goto LABEL_28;
-          v40 = &outz;
-          v39 = &outy;
-          v38 = &outx;
-          v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi;
-          v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
-          goto LABEL_20;
-        }
-        v40 = &outz;
-        v39 = &outy;
-        v38 = &outx;
-        v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi;
-        v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
-      }
-      else
-      {
-        v40 = &outz;
-        v39 = &outy;
-        v38 = &outx;
-        v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
-        v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY;
-      }
-      *(_QWORD *)&v37.x = *(_QWORD *)&pParty->vPosition.x;
-      v36 = 0;
-      v35 = 8;
-LABEL_21:
-      Vec3_int_::Rotate(v35, v18, v36, v37, v38, v39, v40);
-      goto LABEL_28;
-    }
-    v40 = &outz;
-    v39 = &outy;
-    v38 = &outx;
-    v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
-    v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY;
-LABEL_20:
-    *(_QWORD *)&v37 = *(_QWORD *)&pParty->vPosition.x;
-    v36 = 0;
-    v35 = 24;
-    goto LABEL_21;
-  }
-  v9 = v8 - 1;
-  if ( !v9 )
-  {
-    v12 = v4;
-    outx = pLevelDecorations[v12].vPosition.x;
-    v13 = pLevelDecorations[v12].vPosition.y;
-    v14 = pLevelDecorations[v12].vPosition.z;
-LABEL_26:
-    outy = v13;
-    goto LABEL_27;
-  }
-  if ( v9 != 1 )
-  {
-    outz = 0;
-    outy = 0;
-    outx = 0;
-    goto LABEL_28;
-  }
-  if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-  {
-    v10 = &pIndoor->pFaces[v4];
-    outx = (v10->pBounding.x1 + v10->pBounding.x2) >> 1;
-    outy = (v10->pBounding.y1 + v10->pBounding.y2) >> 1;
-    v11 = (v10->pBounding.z1 + v10->pBounding.z2) >> 1;
-LABEL_24:
-    outz = v11;
-  }
-LABEL_28:
   v20 = v6;
   v21 = PID_TYPE(v6);
   v22 = PID_ID(v20);
-  if ( v21 == 2 )
-  {
-    v30 = v22;
-    LODWORD(v45) = pSpriteObjects[v30].vPosition.x;
-    v27 = pSpriteObjects[v30].vPosition.y;
-    v28 = pSpriteObjects[v30].vPosition.z;
-    goto LABEL_43;
-  }
-  if ( v21 == 3 )
-  {
-    LODWORD(v45) = pActors[v22].vPosition.x;
-    LODWORD(v44) = pActors[v22].vPosition.y;
-    v25 = pActors[v22].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v22].uActorHeight * -0.75);
-    goto LABEL_41;
-  }
-  if ( v21 == 4 )
-  {
-    LODWORD(v45) = pParty->vPosition.x;
-    LODWORD(v44) = pParty->vPosition.y;
-    v29 = a4;
-    if ( !a4 )
-      v29 = pParty->sEyelevel;
-    v28 = pParty->vPosition.z + v29;
-    goto LABEL_44;
-  }
-  if ( v21 == 5 )
+  switch(v5)
   {
-    v26 = v22;
-    LODWORD(v45) = pLevelDecorations[v26].vPosition.x;
-    v27 = pLevelDecorations[v26].vPosition.y;
-    v28 = pLevelDecorations[v26].vPosition.z;
-LABEL_43:
-    LODWORD(v44) = v27;
-LABEL_44:
-    a4 = v28;
-    goto LABEL_45;
+	case OBJECT_Item:
+		{
+		v19 = v4;
+		outx = pSpriteObjects[v19].vPosition.x;
+		v13 = pSpriteObjects[v19].vPosition.y;
+		v14 = pSpriteObjects[v19].vPosition.z;
+		outy = v13;
+		outz = v14;
+		v30 = v22;
+		LODWORD(v45) = pSpriteObjects[v30].vPosition.x;
+		v27 = pSpriteObjects[v30].vPosition.y;
+		v28 = pSpriteObjects[v30].vPosition.z;
+		LODWORD(v44) = v27;
+		a4 = v28;
+		break;
+	    }
+	case OBJECT_Actor:
+		{
+		outx = pActors[v4].vPosition.x;
+		outy = pActors[v4].vPosition.y;
+		LODWORD(v42) = pActors[v4].uActorHeight;
+		v11 = pActors[v4].vPosition.z - (unsigned int)(signed __int64)((double)SLODWORD(v42) * -0.75);
+		outz = v11;
+		LODWORD(v45) = pActors[v22].vPosition.x;
+		LODWORD(v44) = pActors[v22].vPosition.y;
+		v25 = pActors[v22].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v22].uActorHeight * -0.75);
+		a4 = v25;
+		break;
+		}
+	case OBJECT_Player:
+		{
+		if ( !v4 )
+		{
+			outx = pParty->vPosition.x;
+			outy = pParty->vPosition.y;
+			v14 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
+			outz = v14;
+			break;;
+		}
+		if ( v4 == 4 )
+		{
+			v40 = &outz;
+			v39 = &outy;
+			v38 = &outx;
+			v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi;
+			v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
+			*(_QWORD *)&v37 = *(_QWORD *)&pParty->vPosition.x;
+			v36 = 0;
+			v35 = 24;
+			Vec3_int_::Rotate(v35, v18, v36, v37, v38, v39, v40);
+			break;
+		}
+		if ( v4 == 3 )
+		{
+			v40 = &outz;
+			v39 = &outy;
+			v38 = &outx;
+			v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi;
+			v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
+			*(_QWORD *)&v37.x = *(_QWORD *)&pParty->vPosition.x;
+			v36 = 0;
+			v35 = 8;
+			Vec3_int_::Rotate(v35, v18, v36, v37, v38, v39, v40);
+			break;
+		}
+		if ( v4 == 2 )
+		{
+			v40 = &outz;
+			v39 = &outy;
+			v38 = &outx;
+			v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
+			v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY;
+			*(_QWORD *)&v37.x = *(_QWORD *)&pParty->vPosition.x;
+			v36 = 0;
+			v35 = 8;
+			Vec3_int_::Rotate(v35, v18, v36, v37, v38, v39, v40);
+			break;
+		}
+		if ( v4 == 1 )
+		{
+			v40 = &outz;
+			v39 = &outy;
+			v38 = &outx;
+			v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
+			v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY;
+			*(_QWORD *)&v37 = *(_QWORD *)&pParty->vPosition.x;
+			v36 = 0;
+			v35 = 24;
+			Vec3_int_::Rotate(v35, v18, v36, v37, v38, v39, v40);
+			break;
+		}
+	    LODWORD(v45) = pParty->vPosition.x;
+		LODWORD(v44) = pParty->vPosition.y;
+		v29 = a4;
+		if ( !a4 )
+		  v29 = pParty->sEyelevel;
+		v28 = pParty->vPosition.z + v29;
+		a4 = v28;
+		}
+	case OBJECT_Decoration:
+		{
+		v12 = v4;
+		outx = pLevelDecorations[v12].vPosition.x;
+		v13 = pLevelDecorations[v12].vPosition.y;
+		v14 = pLevelDecorations[v12].vPosition.z;
+		outy = v13;
+		outz = v14;
+	    v26 = v22;
+		LODWORD(v45) = pLevelDecorations[v26].vPosition.x;
+		v27 = pLevelDecorations[v26].vPosition.y;
+		v28 = pLevelDecorations[v26].vPosition.z;
+		LODWORD(v44) = v27;
+		a4 = v28;
+		break;
+		}
+	default:
+		{
+		outz = 0;
+		outy = 0;
+		outx = 0;
+		a4 = 0;
+		v44 = 0.0;
+		v45 = 0.0;
+		break;
+		}
+	case OBJECT_BModel:
+		{
+		if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
+		{
+			v10 = &pIndoor->pFaces[v4];
+			outx = (v10->pBounding.x1 + v10->pBounding.x2) >> 1;
+			outy = (v10->pBounding.y1 + v10->pBounding.y2) >> 1;
+			v11 = (v10->pBounding.z1 + v10->pBounding.z2) >> 1;
+			outz = v11;
+		}
+		else if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
+		{
+			v23 = &pIndoor->pFaces[v22];
+			v24 = v23->pBounding.y1;
+			LODWORD(v45) = (v23->pBounding.x1 + v23->pBounding.x2) >> 1;
+			LODWORD(v44) = (v24 + v23->pBounding.y2) >> 1;
+			v25 = (v23->pBounding.z1 + v23->pBounding.z2) >> 1;
+			a4 = v25;
+		}
+		break;
+		}
   }
-  if ( v21 != 6 )
-  {
-    a4 = 0;
-    v44 = 0.0;
-    v45 = 0.0;
-    goto LABEL_45;
-  }
-  if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-  {
-    v23 = &pIndoor->pFaces[v22];
-    v24 = v23->pBounding.y1;
-    LODWORD(v45) = (v23->pBounding.x1 + v23->pBounding.x2) >> 1;
-    LODWORD(v44) = (v24 + v23->pBounding.y2) >> 1;
-    v25 = (v23->pBounding.z1 + v23->pBounding.z2) >> 1;
-LABEL_41:
-    a4 = v25;
-  }
-LABEL_45:
   v31 = (double)SLODWORD(v45) - (double)outx;
   v42 = v31;
   v32 = (double)SLODWORD(v44) - (double)outy;
@@ -2087,69 +2074,66 @@
   }
 
   if ( PID_TYPE(sTargetPid) == OBJECT_Actor)
-    {
-      v8 = PID_ID(sTargetPid);
-      v6 = (AIDirection *)pActors[v8].vPosition.x;
-      v7 = (AIDirection *)pActors[v8].vPosition.y;
-      v23 = (signed __int64)((double)pActors[v8].uActorHeight * 0.75 + (double)pActors[v8].vPosition.z);
-    }
-    else
+  {
+	v8 = PID_ID(sTargetPid);
+    v6 = (AIDirection *)pActors[v8].vPosition.x;
+    v7 = (AIDirection *)pActors[v8].vPosition.y;
+    v23 = (signed __int64)((double)pActors[v8].uActorHeight * 0.75 + (double)pActors[v8].vPosition.z);
+  }
+  else if ( PID_TYPE(sTargetPid) == OBJECT_Player)
+  {
+	v6 = (AIDirection *)pParty->vPosition.x;
+    v7 = (AIDirection *)pParty->vPosition.y;
+    v23 = pParty->vPosition.z + pParty->sEyelevel;
+  }
+  else
+  {
+    v6 = arg0;
+	v7 = arg0;
+  }
+  v21 = v3->uActorHeight;
+  v9 = (double)(signed int)v21 * 0.75;
+  v21 = v3->vPosition.z;
+  v10.z = (signed __int64)(v9 + (double)(signed int)v21);
+  v10.y = v3->vPosition.y;
+  v10.x = v3->vPosition.x;
+  if ( sub_407A1C((int)v6, (int)v7, v23, v10) )
+  {
+	v12 = arg0;
+    v13 = 0;
+    if ( !arg0 )
     {
-      if ( PID_TYPE(sTargetPid) == OBJECT_Player)
-      {
-        v6 = (AIDirection *)pParty->vPosition.x;
-        v7 = (AIDirection *)pParty->vPosition.y;
-        v23 = pParty->vPosition.z + pParty->sEyelevel;
-      }
-      else
-      {
-        v6 = arg0;
-        v7 = arg0;
-      }
-    }
-    v21 = v3->uActorHeight;
-    v9 = (double)(signed int)v21 * 0.75;
-    v21 = v3->vPosition.z;
-    v10.z = (signed __int64)(v9 + (double)(signed int)v21);
-    v10.y = v3->vPosition.y;
-    v10.x = v3->vPosition.x;
-    if ( sub_407A1C((int)v6, (int)v7, v23, v10) )
-    {
-      v12 = arg0;
-      v13 = 0;
-      if ( !arg0 )
-      {
-        v14 = Actor::GetDirectionInfo(PID(OBJECT_Actor, v24), sTargetPid, &a3, 0);
+		v14 = Actor::GetDirectionInfo(PID(OBJECT_Actor, v24), sTargetPid, &a3, 0);
         v12 = &v20;
         memcpy(&v20, v14, sizeof(v20));
         v13 = 0;
-      }
-      v15 = pSpriteFrameTable->pSpriteSFrames;
-      v3->uYawAngle = LOWORD(v12->uYawAngle);
-      v16 = v15[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength;
-      v17 = v24;
-      v3->uCurrentActionLength = 8 * v16;
-      v3->uCurrentActionTime = v13;
-      v3->uAIState = AttackingMelee;
-      Actor::PlaySound(v17, 0);
-      LODWORD(v18) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
-      v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
-      if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v13
-        && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v13 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v13) )
-      {
-        LODWORD(v18) = 2 * v18;
+    }
+    v15 = pSpriteFrameTable->pSpriteSFrames;
+    v3->uYawAngle = LOWORD(v12->uYawAngle);
+    v16 = v15[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength;
+    v17 = v24;
+    v3->uCurrentActionLength = 8 * v16;
+    v3->uCurrentActionTime = v13;
+    v3->uAIState = AttackingMelee;
+    Actor::PlaySound(v17, 0);
+    LODWORD(v18) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
+    v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
+    if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v13
+      && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v13 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v13) )
+    {
+		LODWORD(v18) = 2 * v18;
         v25 = v18;
-      }
-      if ( pParty->bTurnBasedModeOn != 1 )
+    }
+    if ( pParty->bTurnBasedModeOn != 1 )
         v18 = (signed __int64)(flt_6BE3A8_debug_recmod2 * (double)(signed int)v25 * 2.133333333333333);
-      v3->pMonsterInfo.uRecoveryTime = v18;
-      v3->vVelocity.z = v13;
-      v3->vVelocity.y = v13;
-      v3->vVelocity.x = v13;
-      v3->UpdateAnimation();
-    }
-    else
-      Actor::_402AD7(v24, sTargetPid, rand() % 2, 64, arg0);
+    v3->pMonsterInfo.uRecoveryTime = v18;
+    v3->vVelocity.z = v13;
+    v3->vVelocity.y = v13;
+    v3->vVelocity.x = v13;
+    v3->UpdateAnimation();
+  }
+  else
+	Actor::_402AD7(v24, sTargetPid, rand() % 2, 64, arg0);
 }
 
 //----- (00438CF3) --------------------------------------------------------
@@ -2231,7 +2215,7 @@
   __int16 v9; // [sp-4h] [bp-8h]@3
 
   result = a2 - 1;
-  v4 = 8 * uActorID | 3;
+  v4 = PID(uActorID,OBJECT_Actor);
   switch ( a2 )
   {
     case 1:
@@ -2282,42 +2266,42 @@
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = 8 * uActorID | 3;
+      v6 = PID(uActorID,OBJECT_Actor);
       v5 = 901;
       goto LABEL_16;
     case 6:
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = 8 * uActorID | 3;
+      v6 = PID(uActorID,OBJECT_Actor);
       v5 = 902;
       goto LABEL_16;
     case 7:
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = 8 * uActorID | 3;
+      v6 = PID(uActorID,OBJECT_Actor);
       v5 = 903;
       goto LABEL_16;
     case 8:
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = 8 * uActorID | 3;
+      v6 = PID(uActorID,OBJECT_Actor);
       v5 = 900;
       goto LABEL_16;
     case 9:
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = 8 * uActorID | 3;
+      v6 = PID(uActorID,OBJECT_Actor);
       v5 = 909;
       goto LABEL_16;
     case 10:
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = 8 * uActorID | 3;
+      v6 = PID(uActorID,OBJECT_Actor);
       v5 = 908;
 LABEL_16:
       result = pOtherOverlayList->_4418B6(v5, v6, v7, v8, v9);
@@ -3034,7 +3018,7 @@
     && v4->uAIState != 18
     && v4->uAIState != 2))
   {
-    memcpy(&v10, Actor::GetDirectionInfo(8 * v3 | 3, a2, &a3, 0), sizeof(v10));
+    memcpy(&v10, Actor::GetDirectionInfo(PID(v3,OBJECT_Actor), a2, &a3, 0), sizeof(v10));
     v6 = pSpriteFrameTable->pSpriteSFrames;
     v4->uYawAngle = LOWORD(v10.uYawAngle);
     v7 = v6[v4->pSpriteIDs[ANIM_GotHit]].uAnimLength;
@@ -3244,7 +3228,7 @@
   v6 = 0;
   v7 = &pActors[uActorID];
   v18 = a2;
-  v8 = 8 * uActorID | 3;
+  v8 = PID(uActorID,OBJECT_Actor);
   v9 = v7->pMonsterInfo.uFlying == 0;
   v17 = v5;
   if ( !v9 && !pParty->bFlying )
@@ -3327,8 +3311,8 @@
   //result = pActors[uActorID].CanAct();
   if ( pActors[uActorID].CanAct() )
   {
-    v7 = 8 * v4 | 3;
-    a1 = 8 * v4 | 3;
+    v7 = PID(v4,OBJECT_Actor);
+    a1 = PID(v4,OBJECT_Actor);
     if ( !a4 )
     {
       a4 = &v12;
@@ -3387,7 +3371,7 @@
   v6 = 0;
   v7 = &pActors[uActorID];
   v19 = a2;
-  v8 = 8 * uActorID | 3;
+  v8 = PID(uActorID,OBJECT_Actor);
   v9 = v7->pMonsterInfo.uFlying == 0;
   v20 = v5;
   if ( !v9 && !pParty->bFlying )
@@ -3473,7 +3457,7 @@
   v5 = 0;
   v6 = &pActors[uActorID];
   v21 = a2;
-  v7 = 8 * uActorID | 3;
+  v7 = PID(uActorID,OBJECT_Actor);
   v8 = v6->pMonsterInfo.uFlying == 0;
   v22 = v4;
   if ( !v8 && !pParty->bFlying )
@@ -3594,7 +3578,7 @@
         actor->uAIState == Removed || actor->uAIState == Summoned || actor->uAIState == Disabled || uActorID == i )
       continue;
 
-		if (_this->uLastCharacterIDToHit == 0 || (v9 = 8 * v5, LOBYTE(v9) = 8 * v5 | 3, _this->uLastCharacterIDToHit != v9) )
+		if (_this->uLastCharacterIDToHit == 0 || (v9 = 8 * v5, LOBYTE(v9) = PID(v5,OBJECT_Actor), _this->uLastCharacterIDToHit != v9) )
 		{
 		  v10 = _this->GetActorsRelation(actor);
 		  if ( v10 == 0 )
@@ -4079,7 +4063,7 @@
     if ( v23->uAttributes & 0x80000 )
       v8->uAttributes |= 0x80000u;
     result = 8 * v24;
-    LOBYTE(result) = 8 * v24 | 3;
+    LOBYTE(result) = PID(v24,OBJECT_Actor);
     v8->uSummonerID = result;
   }
   return result;