diff mm7_6.cpp @ 848:ceef50611567

* AI fixed (temporary) * PID_ID, PID_TYPE replaces * >> 7 error in AudioPlayer
author zipi
date Sun, 31 Mar 2013 10:44:43 +0100
parents dfd683c4f538
children 2db21a810d48
line wrap: on
line diff
--- a/mm7_6.cpp	Sat Mar 30 19:36:05 2013 +0400
+++ b/mm7_6.cpp	Sun Mar 31 10:44:43 2013 +0100
@@ -3557,7 +3557,7 @@
         a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x;
         a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z;
         a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y;
-        a1.spell_target_pid = PID(OBJECT_Actor, a2 >> 3);
+        a1.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2));
         auto obj_id = a1.Create(0, 0, 0, 0);
         DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697);
         LODWORD(v727) = 1;
@@ -3569,12 +3569,12 @@
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
 
-        if ( !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 3u) )
+        if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) )
         {
           LODWORD(v727) = 1;
           goto play_sound_and_continue;
         }
-        pActors[a2 >> 3].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0);
+        pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0);
         v704.x = 0;
         v704.y = 0;
         v704.z = 0;
@@ -3730,7 +3730,7 @@
         if (PID_TYPE(a2) != OBJECT_Actor ||
             (v730 = PID_ID(a2),
               v721 = (int)&pActors[PID_ID(a2)],
-              !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 9u)) )
+              !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9u)) )
         {
         LODWORD(v727) = 1;
         goto play_sound_and_continue;
@@ -3784,7 +3784,7 @@
         v58 = (signed __int64)((double)(23040 * v2) * 0.033333335);
         v59 = v721;
         //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply(
-		pActors[a2 >> 3].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58,
+		pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58,
           v731,
           amount,
           0,
@@ -3826,7 +3826,7 @@
         a1.spell_level = v2;
         a1.spell_skill = v731;
         v60 = pObjectList->ObjectIDByItemID(a1.uType);
-        v61 = a2 >> 3;
+        v61 = PID_ID(a2);
         goto LABEL_1086;
       }
 
@@ -4365,7 +4365,7 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
-        LODWORD(v725) = a2 & 7;
+        LODWORD(v725) = PID_TYPE(a2);
         if (PID_TYPE(a2) == OBJECT_Actor)
         {
           uRequiredMana = pActors[PID_ID(a2)].vPosition.x;
@@ -4731,11 +4731,11 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
-        v208 = a2 & 7;
-        LODWORD(v725) = a2 & 7;
+        v208 = PID_TYPE(a2);
+        LODWORD(v725) = PID_TYPE(a2);
         if ( v208 == 3 )
         {
-          v209 = a2 >> 3;
+          v209 = PID_ID(a2);
           LODWORD(v718) = pActors[v209].vPosition.x;
           v210 = pActors[v209].vPosition.y;
           v211 = pActors[v209].vPosition.z;
@@ -5672,7 +5672,7 @@
         }
         if (PID_TYPE(v342) == OBJECT_Actor)
         {
-          v343 = v342 >> 3;
+          v343 = PID_ID(v342);
           HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32);
           LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280;
           pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0);
@@ -7028,7 +7028,7 @@
           }
           goto play_sound_and_continue;
         }
-        v577 = (Player *)(v576 >> 3);
+        v577 = (Player *)(PID_ID(v576));
         //v726 = v577;
         if ( v577 == (Player *)-1 )
         {
@@ -7791,13 +7791,13 @@
     //v7 = pMouse->uPointingObjectID;
 
   int target_pid = pMouse->uPointingObjectID;
-  int target_type = target_pid & 7,
-      target_id = target_pid >> 3;
+  int target_type = PID_TYPE(target_pid),
+      target_id = PID_ID(target_pid);
   if (target_type != OBJECT_Actor || !pActors[target_id].CanAct())
   {
     target_pid = stru_50C198.FindClosestActor(5120, 0, 0);
-    target_type = target_pid & 7;
-    target_id = target_pid >> 3;
+    target_type = PID_TYPE(target_pid);
+    target_id = PID_ID(target_pid);
   }
 
   auto actor = &pActors[target_id];