changeset 862:f4394e320312

* PID mistake fixed * Actor::GetDirectionInfo mistake fixed
author zipi
date Sun, 31 Mar 2013 13:20:58 +0100
parents fea81e031484
children b7b67485ec43
files Actor.cpp Indoor.cpp Player.cpp Render.cpp Vis.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp
diffstat 9 files changed, 185 insertions(+), 155 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sun Mar 31 12:49:45 2013 +0100
+++ b/Actor.cpp	Sun Mar 31 13:20:58 2013 +0100
@@ -781,7 +781,7 @@
             v24 = (double)v118;
             v118 = v23;
             v112 = v24;
-            v116 = PID(LODWORD(v120),OBJECT_Actor);
+            v116 = PID(OBJECT_Actor,LODWORD(v120));
             do
             {
               v26 = rand();
@@ -915,7 +915,7 @@
             v102 = 0;
             v40 = 8 * LODWORD(v120);
             v101 = -1;
-            LOBYTE(v40) = PID(LOBYTE(v120),OBJECT_Actor);
+            LOBYTE(v40) = PID(OBJECT_Actor,LOBYTE(v120));
             v100 = 0;
             v99 = v40;
             v98 = (SoundID)10040;
@@ -968,7 +968,7 @@
             v102 = 0;
             v43 = 8 * LODWORD(v120);
             v101 = -1;
-            LOBYTE(v43) = PID(LOBYTE(v120),OBJECT_Actor);
+            LOBYTE(v43) = PID(OBJECT_Actor,LOBYTE(v120));
             v100 = 0;
             v99 = v43;
             v98 = (SoundID)14010;
@@ -1007,7 +1007,7 @@
             v102 = 0;
             v46 = 8 * LODWORD(v120);
             v101 = -1;
-            LOBYTE(v46) = PID(LOBYTE(v120),OBJECT_Actor);
+            LOBYTE(v46) = PID(OBJECT_Actor,LOBYTE(v120));
             v100 = 0;
             v99 = v46;
             v98 = (SoundID)13040;
@@ -1050,7 +1050,7 @@
         v50 = 8 * LODWORD(v120);
         v102 = v47;
         v101 = -1;
-        LOBYTE(v50) = PID(LOBYTE(v120),OBJECT_Actor);
+        LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120));
         v100 = v47;
         v99 = v50;
         v98 = (SoundID)14020;
@@ -1102,7 +1102,7 @@
       v65 = 8 * LODWORD(v120);
       v102 = 0;
       v101 = -1;
-      LOBYTE(v65) = PID(LOBYTE(v120),OBJECT_Actor);
+      LOBYTE(v65) = PID(OBJECT_Actor,LOBYTE(v120));
       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) = PID(LOBYTE(v120),OBJECT_Actor);
+        LOBYTE(v52) = PID(OBJECT_Actor,LOBYTE(v120));
         v100 = 0;
         v99 = v52;
         v98 = (SoundID)16060;
@@ -1185,7 +1185,7 @@
         v102 = 0;
         v55 = 8 * LODWORD(v120);
         v101 = -1;
-        LOBYTE(v55) = PID(LOBYTE(v120),OBJECT_Actor);
+        LOBYTE(v55) = PID(OBJECT_Actor,LOBYTE(v120));
         v100 = 0;
         v99 = v55;
         v98 = (SoundID)14060;
@@ -1228,7 +1228,7 @@
         v102 = 0;
         v97 = 8 * LODWORD(v120);
         v101 = -1;
-        LOBYTE(v97) = PID(LOBYTE(v120),OBJECT_Actor);
+        LOBYTE(v97) = PID(OBJECT_Actor,LOBYTE(v120));
         v100 = 0;
         v99 = v97;
         v98 = (SoundID)17070;
@@ -1272,7 +1272,7 @@
         v102 = 0;
         v95 = 8 * LODWORD(v120);
         v101 = -1;
-        LOBYTE(v95) = PID(LOBYTE(v120),OBJECT_Actor);
+        LOBYTE(v95) = PID(OBJECT_Actor,LOBYTE(v120));
         v100 = 0;
         v99 = v95;
         v98 = (SoundID)17080;
@@ -1319,7 +1319,7 @@
         v102 = 0;
         v69 = 8 * LODWORD(v120);
         v101 = -1;
-        LOBYTE(v69) = PID(LOBYTE(v120),OBJECT_Actor);
+        LOBYTE(v69) = PID(OBJECT_Actor,LOBYTE(v120));
         v100 = 0;
         v99 = v69;
         v98 = (SoundID)18060;
@@ -1760,9 +1760,6 @@
   v4 = PID_ID(uObj1ID);
   v5 = PID_TYPE(uObj1ID);
   v6 = uObj2ID;
-  v20 = v6;
-  v21 = PID_TYPE(v6);
-  v22 = PID_ID(v20);
   switch(v5)
   {
 	case OBJECT_Item:
@@ -1773,12 +1770,6 @@
 		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:
@@ -1788,10 +1779,6 @@
 		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:
@@ -1856,13 +1843,6 @@
 			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:
 		{
@@ -1872,12 +1852,6 @@
 		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:
@@ -1885,9 +1859,6 @@
 		outz = 0;
 		outy = 0;
 		outx = 0;
-		a4 = 0;
-		v44 = 0.0;
-		v45 = 0.0;
 		break;
 		}
 	case OBJECT_BModel:
@@ -1899,6 +1870,64 @@
 			outy = (v10->pBounding.y1 + v10->pBounding.y2) >> 1;
 			v11 = (v10->pBounding.z1 + v10->pBounding.z2) >> 1;
 			outz = v11;
+		}
+		break;
+		}
+  }
+  v20 = v6;
+  v21 = PID_TYPE(v6);
+  v22 = PID_ID(v20);
+  switch(v6)
+  {
+	case OBJECT_Item:
+		{
+		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:
+		{
+		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:
+		{
+		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:
+		{
+	    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:
+		{
+		a4 = 0;
+		v44 = 0.0;
+		v45 = 0.0;
+		break;
+		}
+	case OBJECT_BModel:
+		{
+		if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
+		{
 			v23 = &pIndoor->pFaces[v22];
 			v24 = v23->pBounding.y1;
 			LODWORD(v45) = (v23->pBounding.x1 + v23->pBounding.x2) >> 1;
@@ -1909,6 +1938,7 @@
 		break;
 		}
   }
+  
   v31 = (double)SLODWORD(v45) - (double)outx;
   v42 = v31;
   v32 = (double)SLODWORD(v44) - (double)outy;
@@ -2212,7 +2242,7 @@
   __int16 v9; // [sp-4h] [bp-8h]@3
 
   result = a2 - 1;
-  v4 = PID(uActorID,OBJECT_Actor);
+  v4 = PID(OBJECT_Actor,uActorID);
   switch ( a2 )
   {
     case 1:
@@ -2263,42 +2293,42 @@
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = PID(uActorID,OBJECT_Actor);
+      v6 = PID(OBJECT_Actor,uActorID);
       v5 = 901;
       goto LABEL_16;
     case 6:
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = PID(uActorID,OBJECT_Actor);
+      v6 = PID(OBJECT_Actor,uActorID);
       v5 = 902;
       goto LABEL_16;
     case 7:
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = PID(uActorID,OBJECT_Actor);
+      v6 = PID(OBJECT_Actor,uActorID);
       v5 = 903;
       goto LABEL_16;
     case 8:
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = PID(uActorID,OBJECT_Actor);
+      v6 = PID(OBJECT_Actor,uActorID);
       v5 = 900;
       goto LABEL_16;
     case 9:
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = PID(uActorID,OBJECT_Actor);
+      v6 = PID(OBJECT_Actor,uActorID);
       v5 = 909;
       goto LABEL_16;
     case 10:
       v9 = 4;
       v8 = 65536;
       v7 = 0;
-      v6 = PID(uActorID,OBJECT_Actor);
+      v6 = PID(OBJECT_Actor,uActorID);
       v5 = 908;
 LABEL_16:
       result = pOtherOverlayList->_4418B6(v5, v6, v7, v8, v9);
@@ -2494,7 +2524,7 @@
     v10 = 0;
     if ( !pDir )
     {
-      v11 = Actor::GetDirectionInfo(PID(v22,OBJECT_Actor), a2, &a3, 0);
+      v11 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v22), a2, &a3, 0);
       v9 = &v18;
       memcpy(&v18, v11, sizeof(v18));
       v10 = 0;
@@ -2600,7 +2630,7 @@
     v10 = 0;
     if ( !pDir )
     {
-      v11 = Actor::GetDirectionInfo(PID(v22,OBJECT_Actor), sTargetPid, &a3, 0);
+      v11 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v22), sTargetPid, &a3, 0);
       v9 = &v18;
       memcpy(&v18, v11, sizeof(v18));
       v10 = 0;
@@ -2705,7 +2735,7 @@
     v10 = 0;
     if ( !pDir )
     {
-      v11 = Actor::GetDirectionInfo(PID(v21,OBJECT_Actor), sTargetPid, &a3, 0);
+      v11 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v21), sTargetPid, &a3, 0);
       v9 = &v17;
       memcpy(&v17, v11, sizeof(v17));
       v10 = 0;
@@ -2805,7 +2835,7 @@
     v11 = 0;
     if ( !pDir )
     {
-      v12 = Actor::GetDirectionInfo(PID(v21,OBJECT_Actor), sTargetPid, &a3, 0);
+      v12 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v21), sTargetPid, &a3, 0);
       v10 = &v18;
       memcpy(&v18, v12, sizeof(v18));
       v11 = 0;
@@ -3015,7 +3045,7 @@
     && v4->uAIState != 18
     && v4->uAIState != 2))
   {
-    memcpy(&v10, Actor::GetDirectionInfo(PID(v3,OBJECT_Actor), a2, &a3, 0), sizeof(v10));
+    memcpy(&v10, Actor::GetDirectionInfo(PID(OBJECT_Actor,v3), a2, &a3, 0), sizeof(v10));
     v6 = pSpriteFrameTable->pSpriteSFrames;
     v4->uYawAngle = LOWORD(v10.uYawAngle);
     v7 = v6[v4->pSpriteIDs[ANIM_GotHit]].uAnimLength;
@@ -3039,7 +3069,7 @@
   
   AIDirection a3; // [sp+Ch] [bp-5Ch]@2
   if (!a4)
-    a4 = Actor::GetDirectionInfo(PID(uActorID,OBJECT_Actor), uObjID, &a3, 0);
+    a4 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), uObjID, &a3, 0);
 
   actor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[actor->pSpriteIDs[ANIM_Bored]].uAnimLength;
 
@@ -3225,7 +3255,7 @@
   v6 = 0;
   v7 = &pActors[uActorID];
   v18 = a2;
-  v8 = PID(uActorID,OBJECT_Actor);
+  v8 = PID(OBJECT_Actor,uActorID);
   v9 = v7->pMonsterInfo.uFlying == 0;
   v17 = v5;
   if ( !v9 && !pParty->bFlying )
@@ -3308,8 +3338,8 @@
   //result = pActors[uActorID].CanAct();
   if ( pActors[uActorID].CanAct() )
   {
-    v7 = PID(v4,OBJECT_Actor);
-    a1 = PID(v4,OBJECT_Actor);
+    v7 = PID(OBJECT_Actor,v4);
+    a1 = PID(OBJECT_Actor,v4);
     if ( !a4 )
     {
       a4 = &v12;
@@ -3368,7 +3398,7 @@
   v6 = 0;
   v7 = &pActors[uActorID];
   v19 = a2;
-  v8 = PID(uActorID,OBJECT_Actor);
+  v8 = PID(OBJECT_Actor,uActorID);
   v9 = v7->pMonsterInfo.uFlying == 0;
   v20 = v5;
   if ( !v9 && !pParty->bFlying )
@@ -3453,7 +3483,7 @@
   v5 = 0;
   v6 = &pActors[uActorID];
   v21 = a2;
-  v7 = PID(uActorID,OBJECT_Actor);
+  v7 = PID(OBJECT_Actor,uActorID);
   v8 = v6->pMonsterInfo.uFlying == 0;
   if ( !v8 && !pParty->bFlying )
   {
@@ -3563,7 +3593,7 @@
         actor->uAIState == Removed || actor->uAIState == Summoned || actor->uAIState == Disabled || uActorID == i )
       continue;
 
-		if (_this->uLastCharacterIDToHit == 0 || (v9 = 8 * v5, LOBYTE(v9) = PID(v5,OBJECT_Actor), _this->uLastCharacterIDToHit != v9) )
+		if (_this->uLastCharacterIDToHit == 0 || (v9 = 8 * v5, LOBYTE(v9) = PID(OBJECT_Actor,v5), _this->uLastCharacterIDToHit != v9) )
 		{
 		  v10 = _this->GetActorsRelation(actor);
 		  if ( v10 == 0 )
@@ -3609,7 +3639,7 @@
   	  if ( v25 != -1 )
 	  {
 		//v13 = 8 * v21;
-		//LOBYTE(v13) = PID(v21,OBJECT_Actor);
+		//LOBYTE(v13) = PID(OBJECT_Actor,v21);
 		*a2 = PID(OBJECT_Actor, v21);
 	  }
 
@@ -4048,7 +4078,7 @@
     if ( v23->uAttributes & 0x80000 )
       v8->uAttributes |= 0x80000u;
     result = 8 * v24;
-    LOBYTE(result) = PID(v24,OBJECT_Actor);
+    LOBYTE(result) = PID(OBJECT_Actor,v24);
     v8->uSummonerID = result;
   }
   return result;
--- a/Indoor.cpp	Sun Mar 31 12:49:45 2013 +0100
+++ b/Indoor.cpp	Sun Mar 31 13:20:58 2013 +0100
@@ -3478,15 +3478,15 @@
             //v66 = 0;
             //v65 = 0;
             //v64 = 0;
-            //v7 = PID(i,OBJECT_BLVDoor);
+            //v7 = PID(OBJECT_BLVDoor,i);
             //v63 = 0;
             //v62 = -1;
-            //LOBYTE(v7) = PID(i,OBJECT_BLVDoor);
+            //LOBYTE(v7) = PID(OBJECT_BLVDoor,i);
             //v61 = 0;
-            //v60 = PID(i,OBJECT_BLVDoor);
+            //v60 = PID(OBJECT_BLVDoor,i);
             //v59 = (SoundID)((int)eDoorSoundID + 1);
 //LABEL_17:
-            pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), PID(i,OBJECT_BLVDoor), 0, -1, 0, 0, 0, 0);
+            pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), PID(OBJECT_BLVDoor,i), 0, -1, 0, 0, 0, 0);
             //goto LABEL_18;
           }
           goto LABEL_18;
@@ -3509,14 +3509,14 @@
         //v66 = 0;
         //v65 = 0;
         //v64 = 0;
-        //v8 = PID(i,OBJECT_BLVDoor);
+        //v8 = PID(OBJECT_BLVDoor,i);
         //v63 = 0;
         //v62 = -1;
         //LOBYTE(v8) = 8 * v1 | 1;
         //v61 = 1;
-        //v60 = PID(i,OBJECT_BLVDoor);
+        //v60 = PID(OBJECT_BLVDoor,i);
         //v59 = eDoorSoundID;
-        pAudioPlayer->PlaySound(eDoorSoundID, PID(i,OBJECT_BLVDoor), 1, -1, 0, 0, 0, 0);
+        pAudioPlayer->PlaySound(eDoorSoundID, PID(OBJECT_BLVDoor,i), 1, -1, 0, 0, 0, 0);
         //goto LABEL_18;
       }
 LABEL_18:
@@ -3999,7 +3999,7 @@
       {
         v58 = v22;
         v24 = 8 * v63;
-        LOBYTE(v24) = PID(v63,OBJECT_Actor);
+        LOBYTE(v24) = PID(OBJECT_Actor,v63);
         v61 = v22;
         _this = v24;
         do
--- a/Player.cpp	Sun Mar 31 12:49:45 2013 +0100
+++ b/Player.cpp	Sun Mar 31 13:20:58 2013 +0100
@@ -7488,7 +7488,7 @@
           }
           pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1);
           v5 = 8 * a2 + 392;
-          LOBYTE(v5) = PID(a2 - 120,OBJECT_Player);
+          LOBYTE(v5) = PID(OBJECT_Player,a2 - 120);
           pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0);
           v3->AddVariable(VAR_NumSkillPoints, 2);
         }
@@ -8309,7 +8309,7 @@
       }
 LABEL_172:
       v25 = 8 * currPlayerId + 400;
-      LOBYTE(v25) = PID(currPlayerId - 112,OBJECT_Player);
+      LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
       pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
       return;
     }
@@ -8459,7 +8459,7 @@
 		  if ( v31 != 1 )
 			  return;
 		  v25 = 8 * currPlayerId + 400;
-		  LOBYTE(v25) = PID(currPlayerId - 112,OBJECT_Player);
+		  LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
 		  pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
 		  return;
         case VAR_PlayerItemInHands:
@@ -8733,7 +8733,7 @@
 			  return;
 		  v5 = 0;
 		  v25 = 8 * currPlayerId + 400;
-		  LOBYTE(v25) = PID(currPlayerId - 112,OBJECT_Player);
+		  LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
 		  pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
 		  return;
 		  }
@@ -9255,7 +9255,7 @@
       bFlashHistoryBook = 1;
 _play_sound:
       v28 = 8 * uPlayerIdx + 400;
-      LOBYTE(v28) = PID(uPlayerIdx - 112,OBJECT_Player);
+      LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112);
       pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0);
       return;
     }
@@ -9465,14 +9465,14 @@
           GameUI_DrawFoodAndGold();
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_CurrentHP:
           ReceiveDamage((signed int)pValue, 4);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_CurrentSP:
@@ -9483,28 +9483,28 @@
             *(int *)v9 = 0;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_ACModifier:
           this->sACModifier -= (unsigned __int8)pValue;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_BaseLevel:
           this->uLevel -= (unsigned __int8)pValue;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_LevelModifier:
           this->sLevelModifier -= (unsigned __int8)pValue;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_Age:
@@ -9521,7 +9521,7 @@
           *((int *)v12 + 1) -= v14 + HIDWORD(v13);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_QBits_QuestsDone:
@@ -9542,7 +9542,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_IntellectBonus:
@@ -9551,7 +9551,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_PersonalityBonus:
@@ -9560,7 +9560,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_EnduranceBonus:
@@ -9569,7 +9569,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_SpeedBonus:
@@ -9578,7 +9578,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_AccuracyBonus:
@@ -9587,7 +9587,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_LuckBonus:
@@ -9596,7 +9596,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_BaseMight:
@@ -9604,7 +9604,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_BaseIntellect:
@@ -9612,7 +9612,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_BasePersonality:
@@ -9620,7 +9620,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_BaseEndurance:
@@ -9628,7 +9628,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_BaseSpeed:
@@ -9636,7 +9636,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_BaseAccuracy:
@@ -9644,7 +9644,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_BaseLuck:
@@ -9652,7 +9652,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_FireResistance:
@@ -9660,7 +9660,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_AirResistance:
@@ -9668,7 +9668,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_WaterResistance:
@@ -9676,7 +9676,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_EarthResistance:
@@ -9684,7 +9684,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_SpiritResistance:
@@ -9692,7 +9692,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_MindResistance:
@@ -9700,7 +9700,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_BodyResistance:
@@ -9708,7 +9708,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_LightResistance:
@@ -9716,7 +9716,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_DarkResistance:
@@ -9724,7 +9724,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_MagicResistance:
@@ -9732,7 +9732,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_FireResistanceBonus:
@@ -9740,7 +9740,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_AirResistanceBonus:
@@ -9748,7 +9748,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_WaterResistanceBonus:
@@ -9756,7 +9756,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_EarthResistanceBonus:
@@ -9764,7 +9764,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_SpiritResistanceBonus:
@@ -9772,7 +9772,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_MindResistanceBonus:
@@ -9780,7 +9780,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_BodyResistanceBonus:
@@ -9788,7 +9788,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_LightResistanceBonus:
@@ -9796,7 +9796,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_DarkResistanceBonus:
@@ -9804,7 +9804,7 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_MagicResistanceBonus:
@@ -9814,14 +9814,14 @@
           pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_FixedFood:
           Party::TakeFood((unsigned int)pValue);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_StaffSkill:
@@ -9857,7 +9857,7 @@
           *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         case VAR_Cursed:
@@ -9881,7 +9881,7 @@
           *((int *)this + 2 * result - 209) = 0;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
-          LOBYTE(v8) = PID(v4 - 112,OBJECT_Player);
+          LOBYTE(v8) = PID(OBJECT_Player,v4 - 112);
           pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0);
           return result;
         default:
--- a/Render.cpp	Sun Mar 31 12:49:45 2013 +0100
+++ b/Render.cpp	Sun Mar 31 13:20:58 2013 +0100
@@ -3183,7 +3183,7 @@
                   HIWORD(v26) = HIWORD(v42);
                   LOWORD(v26) = 0;
                   v27 = (object->uAttributes & 0x20) == 0;
-                  v3->sZValue = v26 + (PID(i,OBJECT_Item));
+                  v3->sZValue = v26 + (PID(OBJECT_Item,i));
                   v3->dimming_level = 0;
                   v3->uTintColor = 0;
                   if ( !v27 )
@@ -3683,7 +3683,7 @@
                     v27->world_z = decor->vPosition.z;
                     v27->uScreenSpaceY = v40;
                     HIWORD(v30) = HIWORD(v39);
-                    v31 = PID(i,OBJECT_Decoration);
+                    v31 = PID(OBJECT_Decoration,i);
                     LOWORD(v30) = 0;
                     v27->uIndoorSectorID = 0;
                     v27->sZValue = v30 + v31;
--- a/Vis.cpp	Sun Mar 31 12:49:45 2013 +0100
+++ b/Vis.cpp	Sun Mar 31 13:20:58 2013 +0100
@@ -329,7 +329,7 @@
               pGame->pIndoorCameraD3D->ViewTransform(&a1, 1);
               v9 = _48B561_mess_with_scaling_along_z(/*v8, */a1.vWorldViewPosition.x);
               LOWORD(v9) = 0;
-              v15 = (void *)((PID(pFaceID,OBJECT_BModel)) + v9);
+              v15 = (void *)((PID(OBJECT_BModel,pFaceID)) + v9);
               pNumPointers = &list->uNumPointers;
               //v16 = 2;
               //v11 = list->uNumPointers;
--- a/mm7_2.cpp	Sun Mar 31 12:49:45 2013 +0100
+++ b/mm7_2.cpp	Sun Mar 31 13:20:58 2013 +0100
@@ -4124,7 +4124,7 @@
     {
       if ( v20 == uNumActors )
         ++uNumActors;
-      v6->uSummonerID = PID(v17,OBJECT_Player);
+      v6->uSummonerID = PID(OBJECT_Player,v17);
       result = v6->pActorBuffs[2].Apply(
                  pParty->uTimePlayed + (signed __int64)((double)(a3 << 7) * 0.033333335),
                  v16,
@@ -11283,7 +11283,7 @@
             v115 = 8 * v153;
             v129 = 0;
             v128 = -1;
-            LOBYTE(v115) = PID(v153,OBJECT_Item);
+            LOBYTE(v115) = PID(OBJECT_Item,v153);
             v127 = 0;
             v126 = v115;
             v116 = v143;
@@ -11553,7 +11553,7 @@
 LABEL_132:
         v73 = v2->vPosition.z;
         v74 = v2->vPosition.y;
-        v75 = PID(v72,OBJECT_Item);
+        v75 = PID(OBJECT_Item,v72);
         v2->vVelocity.z = v66;
         v2->vVelocity.y = v66;
         v76 = v2->vPosition.x;
@@ -11872,7 +11872,7 @@
     v2->vVelocity.z = 0;
     v38 = 8 * v153;
     v39 = v2->vPosition.y;
-    LOBYTE(v38) = PID(v153,OBJECT_Item);
+    LOBYTE(v38) = PID(OBJECT_Item,v153);
     v2->vVelocity.y = 0;
     v2->vVelocity.x = 0;
     v40 = v2->vPosition.x;
@@ -11930,7 +11930,7 @@
         v2->uSpriteFrameID = v32;
         v102 = 8 * v153;
         v103 = v2->vPosition.y;
-        LOBYTE(v102) = PID(v153,OBJECT_Item);
+        LOBYTE(v102) = PID(OBJECT_Item,v153);
         v2->vVelocity.x = v32;
         v2->vVelocity.y = v32;
         v104 = v2->vPosition.x;
@@ -12024,7 +12024,7 @@
   v13 = 8 * v153;
   v129 = v9;
   v128 = -1;
-  LOBYTE(v13) = PID(v153,OBJECT_Item);
+  LOBYTE(v13) = PID(OBJECT_Item,v153);
   v127 = v9;
   v126 = v13;
 LABEL_28:
--- a/mm7_3.cpp	Sun Mar 31 12:49:45 2013 +0100
+++ b/mm7_3.cpp	Sun Mar 31 13:20:58 2013 +0100
@@ -1114,7 +1114,7 @@
       v30 = WorldPosToGridCellX(v0->vPosition.x);
       _46E26D_collide_against_sprites(v30, v29);
       _46EF01_collision_chech_player(0);
-      _46ED8A_collide_against_sprite_objects(PID(v75,OBJECT_Actor));
+      _46ED8A_collide_against_sprite_objects(PID(OBJECT_Actor,v75));
       v31 = 0;
       for ( i = 0; v31 < ai_arrays_size; ++v31 )
       {
@@ -1447,7 +1447,7 @@
           v10 = i;
           if ( !(v9 & 0x40) )
             goto LABEL_35;
-          _46BFFA_check_object_intercept(i, PID(i,OBJECT_Item));
+          _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i));
         }
     }
 LABEL_36:
@@ -2343,7 +2343,7 @@
           v6 = v108 & 0x3F;
           /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 )
           {
-            pParty->field_6F4_packedid = PID(v108,OBJECT_BModel);
+            pParty->field_6F4_packedid = PID(OBJECT_BModel,v108);
             v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292);
           }*/
 		  if ( BYTE3(v7[v6].uAttributes) & 4 )
@@ -6225,7 +6225,7 @@
       uFaceID = v65;
     }
     v56 = 8 * uFaceID;
-    LOBYTE(v56) = PID(uFaceID,OBJECT_BModel);
+    LOBYTE(v56) = PID(OBJECT_BModel,uFaceID);
     v57 = v56;
     v58 = pFace->GetTexture();
     pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0);
@@ -11152,11 +11152,11 @@
               v15->uScreenSpaceX = a5;
               v15->uScreenSpaceY = a6;
               //v23 = 8 * uDecorationID;
-              //LOBYTE(v23) = PID(uDecorationID,OBJECT_Decoration);
+              //LOBYTE(v23) = PID(OBJECT_Decoration,uDecorationID);
 
               //v15->sZValue = v22 + v23;
               v15->actual_z = HIWORD(x);
-              v15->object_pid = PID(uDecorationID,OBJECT_Decoration);
+              v15->object_pid = PID(OBJECT_Decoration,uDecorationID);
 
               v15->uTintColor = 0;
               v15->pSpriteFrame = v12;
@@ -11309,12 +11309,12 @@
               v3->uTintColor = 0;
               v3->uScreenSpaceY = v22;
               //v23 = 8 * i;
-              //LOBYTE(v23) = PID(i,OBJECT_Item);
+              //LOBYTE(v23) = PID(OBJECT_Item,i);
               v3->pSpriteFrame = v24;
               //v12 = (p->uAttributes & 0x20) == 0;
               //v3->sZValue = v21 + v23;
               v3->actual_z = HIWORD(x);
-              v3->object_pid = PID(i,OBJECT_Item);
+              v3->object_pid = PID(OBJECT_Item,i);
               if (p->uAttributes & 0x20)
               {
                 if ( !pRenderer->pRenderD3D )
@@ -14971,7 +14971,7 @@
   {
     v20 = &pActors[ai_near_actors_ids[v18]];
     if ( v20->uAttributes & 0x8000
-      || (v21 = sub_4070EF_prolly_collide_objects(PID(ai_near_actors_ids[v18],OBJECT_Actor), 4u), v18 = i, v21) )
+      || (v21 = sub_4070EF_prolly_collide_objects(PID(OBJECT_Actor,ai_near_actors_ids[v18]), 4u), v18 = i, v21) )
     {
       v22 = ai_near_actors_ids[v18];
       v20->uAttributes |= 0x8000u;
@@ -15388,8 +15388,8 @@
 				v21->pMonsterInfo.uRecoveryTime = 0;
 			if ( !(v21->uAttributes & 0x8000) )
 				v21->uAttributes |= 0x8000;
-			a1 = PID(actor_id,OBJECT_Actor);
-			v30 = Actor::GetDirectionInfo(PID(actor_id,OBJECT_Actor), target_pid, &a3, 0);
+			a1 = PID(OBJECT_Actor,actor_id);
+			v30 = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_pid, &a3, 0);
 			memcpy(&v75, v30, sizeof(v75));
 			memcpy(&pDir, &v75, sizeof(pDir));
 			uAIState = v21->uAIState; 
@@ -16025,7 +16025,7 @@
   {
     if ( v40->CanAct() )
     {
-      *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = PID(v3,OBJECT_Player);
+      *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = PID(OBJECT_Player,v3);
       v1->pQueue[v1->uActorQueueSize].field_C = 2;
       v1->pQueue[v1->uActorQueueSize].uActionLength = 0;
       pParty->pTurnBasedPlayerRecoveryTimes[v1->uActorQueueSize++] = 0;
@@ -16055,8 +16055,8 @@
             v8 = ai_near_actors_targets_pid[v5];
             LOBYTE(v7) = v7 | 0x80;
             v6->uAttributes = v7;
-            v33 = PID(v5,OBJECT_Actor);
-            memcpy(&v31, Actor::GetDirectionInfo(PID(v5,OBJECT_Actor), v8, &a3, 0), sizeof(v31));
+            v33 = PID(OBJECT_Actor,v5);
+            memcpy(&v31, Actor::GetDirectionInfo(PID(OBJECT_Actor,v5), v8, &a3, 0), sizeof(v31));
             memcpy(&v30, &v31, sizeof(v30));
             Actor::AI_StandOrBored(v37, 4, 32, &v30);
             *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = v33;
--- a/mm7_4.cpp	Sun Mar 31 12:49:45 2013 +0100
+++ b/mm7_4.cpp	Sun Mar 31 13:20:58 2013 +0100
@@ -133,7 +133,7 @@
         v5 = v8;
       }
       if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 )
-        EventProcessor(v1->field_16_event_id, PID(i,OBJECT_Decoration), 1);
+        EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1);
     }
     if ( v1->field_2 & 2 )
     {
@@ -977,7 +977,7 @@
     {
       stru_721530.field_7C = v13;
       v14 = 8 * v16;
-      LOBYTE(v14) = PID(v16,OBJECT_Actor);
+      LOBYTE(v14) = PID(OBJECT_Actor,v16);
       stru_721530.uFaceID = v14;
     }
     result = 1;
@@ -2133,11 +2133,11 @@
           v17 = pActors[v16].vPosition.y;
           a1.vPosition.z = pActors[v16].vPosition.z;
           v18 = 8 * v15;
-          LOBYTE(v18) = PID(v15,OBJECT_Actor);
+          LOBYTE(v18) = PID(OBJECT_Actor,v15);
           a1.vPosition.y = v17;
           a1.spell_target_pid = v18;
           v19 = a1.Create(0, 0, 0, 0);
-          DamageMonsterFromParty(PID(v19,OBJECT_Item), *v14, &a3);
+          DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3);
           ++v9;
         }
         while ( v9 < v13 );
@@ -5521,7 +5521,7 @@
   v68 = v2;
   v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0);
   v6 = 8 * uFaceID;
-  LOBYTE(v6) = PID(uFaceID,OBJECT_BModel);
+  LOBYTE(v6) = PID(OBJECT_BModel,uFaceID);
   stru_F8AD28.field_0 = v6;
   stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x;
   stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y;
@@ -8707,7 +8707,7 @@
             if ( (signed int)v4->uCurrentActionTime >= v5 )
             {
               v17 = ai_near_actors_targets_pid[v20];
-              v6 = Actor::GetDirectionInfo(PID(v20,OBJECT_Actor), v17, &a3, v2);
+              v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2);
               v7 = v4->uAIState;
               memcpy(&v15, v6, sizeof(v15));
               v8 = v7 - 4;
@@ -8996,9 +8996,9 @@
     LOWORD(v25) = 0;
     LOBYTE(v26) = v41;
 
-    //v0->sZValue = v25 + (PID(i,OBJECT_Actor));
+    //v0->sZValue = v25 + (PID(OBJECT_Actor,i));
     v0->actual_z = HIWORD(x);
-    v0->object_pid = PID(i,OBJECT_Actor);
+    v0->object_pid = PID(OBJECT_Actor,i);
 
     v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0;
     v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0;
--- a/mm7_5.cpp	Sun Mar 31 12:49:45 2013 +0100
+++ b/mm7_5.cpp	Sun Mar 31 13:20:58 2013 +0100
@@ -5321,7 +5321,7 @@
     }
     v17 = (SoundID)a4;
 LABEL_26:
-    pAudioPlayer->PlaySound(v17, PID(a4 + 80,OBJECT_Player), 0, -1, 0, 0, 0, 0);
+    pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0);
     v18 = Actor::_43B3E0_CalcDamage(v7, v74);
     v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0;
     v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0;
@@ -5381,7 +5381,7 @@
             {
               if ( v7->sCurrentHP >= 1 )
               {
-                Actor::Stun(uActorID, PID(a4,OBJECT_Player), 0);
+                Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0);
                 Actor::AggroSurroundingPeasants(uActorID, 1);
               }
               else
@@ -5567,7 +5567,7 @@
                   {
                     if ( v44->sCurrentHP >= 1 )
                     {
-                      Actor::Stun(uActorID, PID(a4,OBJECT_Player), 0);
+                      Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0);
                       Actor::AggroSurroundingPeasants(uActorID, 1);
                     }
                     else
@@ -6779,7 +6779,7 @@
     {
       *(int *)v4 = 100;
       v6 = 8 * v19;
-      LOBYTE(v6) = PID(v19,OBJECT_Player);
+      LOBYTE(v6) = PID(OBJECT_Player,v19);
       *((int *)v4 + 2) = v2;
       *((int *)v4 - 1) = v6;
       *((int *)v4 + 1) = v2;
@@ -6815,7 +6815,7 @@
         v9 = ai_near_actors_ids[v20];
         *(int *)v7 = 1;
         *((int *)v7 + 2) = v2;
-        *((int *)v7 - 1) = PID(v9,OBJECT_Actor);
+        *((int *)v7 - 1) = PID(OBJECT_Actor,v9);
         *((int *)v7 + 1) = v2;
         ++v3;
         v7 += 16;
@@ -7409,7 +7409,7 @@
         if ( v5->pMonsterInfo.uHostilityType && !*v6 )
           v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
         v22 = *v6;
-        v7 = Actor::GetDirectionInfo(PID((int)v4,OBJECT_Actor), *v6, &a3, 0);
+        v7 = Actor::GetDirectionInfo(PID(OBJECT_Actor,(int)v4), *v6, &a3, 0);
         v8 = v5->uActorRadius;
         memcpy(&a3, v7, sizeof(a3));
         memcpy(&v18, &a3, sizeof(v18));