changeset 823:c1da83d8223f

More spell renames
author Nomad
date Tue, 26 Mar 2013 20:05:57 +0200
parents c232f160e6f3
children fe4c8b113548
files Actor.cpp Chest.cpp MM7.h SpriteObject.h mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_6.cpp stru277.h
diffstat 9 files changed, 122 insertions(+), 174 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Tue Mar 26 17:56:24 2013 +0200
+++ b/Actor.cpp	Tue Mar 26 20:05:57 2013 +0200
@@ -613,7 +613,7 @@
               LOBYTE(v18) = 8 * LOBYTE(v120) | AI_OBJECT_ACTOR;
               a1.spell_caster_pid = v18;
               a1.uSpriteFrameID = 0;
-              a1.field_5C = 0;
+              a1.spell_target_pid = 0;
               a1.field_60_distance_related_prolly_lod = 3;
               v19 = spellnuma / -2;
               a1a = spellnuma / 2;
@@ -697,7 +697,7 @@
             LOBYTE(v90) = 8 * LOBYTE(v120) | OBJECT_Actor;
             a1.uSpriteFrameID = 0;
             a1.spell_caster_pid = v90;
-            a1.field_5C = 0;
+            a1.spell_target_pid = 0;
             a1.field_60_distance_related_prolly_lod = 3;
             if ( (double)v89 >= 307.2 )
             {
@@ -832,7 +832,7 @@
               a1.uSectorID = 0;
               a1.uSpriteFrameID = 0;
               a1.spell_caster_pid = v116;
-              a1.field_5C = 0;
+              a1.spell_target_pid = 0;
               a1.field_60_distance_related_prolly_lod = stru_50C198._427546(v30 + 2500);
               a1.uFacing = v32;
               a1.uSoundID = 0;
@@ -1386,7 +1386,7 @@
   LOBYTE(v78) = 8 * LOBYTE(v120) | OBJECT_Actor;
   a1.spell_caster_pid = v78;
   a1.uSpriteFrameID = 0;
-  a1.field_5C = 0;
+  a1.spell_target_pid = 0;
   a1.field_60_distance_related_prolly_lod = 3;
   a1c = spellnume / -2;
   if ( spellnume / -2 > spellnume / 2 )
@@ -1584,7 +1584,7 @@
   LOBYTE(v12) = 8 * v15 | AI_OBJECT_ACTOR;
   a1.uSpriteFrameID = 0;
   a1.spell_caster_pid = v12;
-  a1.field_5C = 0;
+  a1.spell_target_pid = 0;
   if ( (double)v11 >= 307.2 )
   {
     if ( v11 >= 1024 )
@@ -1690,7 +1690,7 @@
   LOBYTE(v7) = 8 * v10 | OBJECT_Actor;
   a1.uSpriteFrameID = 0;
   a1.spell_caster_pid = v7;
-  a1.field_5C = 0;
+  a1.spell_target_pid = 0;
   a1.field_60_distance_related_prolly_lod = 3;
   a1.field_61 = 4;
   return a1.Create(0, 0, 0, 0);
--- a/Chest.cpp	Tue Mar 26 17:56:24 2013 +0200
+++ b/Chest.cpp	Tue Mar 26 20:05:57 2013 +0200
@@ -211,7 +211,7 @@
     a1.uSectorID = pIndoor->GetSector(pOut.x, pOut.z, pOut.y);
     a1.uSpriteFrameID = 0;
     a1.spell_caster_pid = 0;
-    a1.field_5C = 0;
+    a1.spell_target_pid = 0;
     a1.uFacing = 0;
     a1.Create(0, 0, 0, 0);
     pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
--- a/MM7.h	Tue Mar 26 17:56:24 2013 +0200
+++ b/MM7.h	Tue Mar 26 20:05:57 2013 +0200
@@ -21,6 +21,8 @@
 #define BYTE2(a) (*((unsigned char *)&a + 2))
 #define BYTE3(a) (*((unsigned char *)&a + 3))
 
+#define PID(type, id) (unsigned int)((((8 * (id))) | (type)) & 0xFFFF)  // packed id
+
 
 typedef unsigned __int16 _WORD;
 typedef unsigned __int64 _QWORD;
--- a/SpriteObject.h	Tue Mar 26 17:56:24 2013 +0200
+++ b/SpriteObject.h	Tue Mar 26 20:05:57 2013 +0200
@@ -41,7 +41,7 @@
   int spell_skill;
   int field_54;
   int spell_caster_pid;
-  int field_5C;
+  int spell_target_pid;
   char field_60_distance_related_prolly_lod;
   char field_61;
   char field_62[2];
--- a/mm7_2.cpp	Tue Mar 26 17:56:24 2013 +0200
+++ b/mm7_2.cpp	Tue Mar 26 20:05:57 2013 +0200
@@ -4306,7 +4306,7 @@
   a1a.spell_skill = 0;
   a1a.spell_level = 0;
   a1a.spell_id = 0;
-  a1a.field_5C = 0;
+  a1a.spell_target_pid = 0;
   a1a.spell_caster_pid = 0;
   a1a.uSpriteFrameID = 0;
   a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);;
--- a/mm7_3.cpp	Tue Mar 26 17:56:24 2013 +0200
+++ b/mm7_3.cpp	Tue Mar 26 20:05:57 2013 +0200
@@ -1390,7 +1390,7 @@
       v4 = &pObjectList->pObjects[item->uObjectDescID];
       if (item->AttachedToActor())
       {
-          v5 = item->field_5C >> 3;
+          v5 = item->spell_target_pid >> 3;
           *(int *)(v2 - 26) = pActors[v5].vPosition.x;
           *(int *)(v2 - 22) = pActors[v5].vPosition.y;
           *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight;
@@ -13853,7 +13853,7 @@
           a1.field_60_distance_related_prolly_lod = v55;
           a1.uSpriteFrameID = 0;
           a1.spell_caster_pid = 8000 | OBJECT_Item;
-          a1.field_5C = 4;
+          a1.spell_target_pid = 4;
           a1.uSoundID = 0;
           for ( i = a7c / -2; i <= a7c / 2; i += a8b )
           {
@@ -13894,7 +13894,7 @@
         v20 = yaw;
         a1.uSpriteFrameID = 0;
         a1.spell_caster_pid = 8000 | OBJECT_Item;
-        a1.field_5C = 0;
+        a1.spell_target_pid = 0;
         a1.uFacing = yaw;
         a1.uSoundID = 0;
         v51 = 0;
@@ -13948,7 +13948,7 @@
         a1.field_60_distance_related_prolly_lod = v55;
         a1.uSpriteFrameID = 0;
         a1.spell_caster_pid = 8000 | OBJECT_Item;
-        a1.field_5C = 4;
+        a1.spell_target_pid = 4;
         a1.uSoundID = 0;
         for ( j = a7d / -2; j <= a7d / 2; j += a8c )
         {
@@ -14102,7 +14102,7 @@
     a1.field_60_distance_related_prolly_lod = v55;
     a1.uSpriteFrameID = 0;
     a1.spell_caster_pid = 8000 | OBJECT_Item;
-    a1.field_5C = 4;
+    a1.spell_target_pid = 4;
     a1.uSoundID = 0;
     v51 = 0;
     v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
--- a/mm7_4.cpp	Tue Mar 26 17:56:24 2013 +0200
+++ b/mm7_4.cpp	Tue Mar 26 20:05:57 2013 +0200
@@ -2119,7 +2119,7 @@
           v18 = 8 * v15;
           LOBYTE(v18) = 8 * v15 | 3;
           a1.vPosition.y = v17;
-          a1.field_5C = v18;
+          a1.spell_target_pid = v18;
           v19 = a1.Create(0, 0, 0, 0);
           DamageMonsterFromParty(8 * v19 | 2, *v14, &a3);
           ++v9;
--- a/mm7_6.cpp	Tue Mar 26 17:56:24 2013 +0200
+++ b/mm7_6.cpp	Tue Mar 26 20:05:57 2013 +0200
@@ -2421,7 +2421,7 @@
 }
 
 //----- (00427DA0) --------------------------------------------------------
-unsigned int stru277::PushStru277(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int a6)
+unsigned int stru277::PushStru277(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id)
 {
   unsigned int result; // eax@1
   stru277 *v7; // edx@1
@@ -2445,7 +2445,7 @@
   v8->spell_target_pid = 0;
   v8->field_8 = a5;
   v8->forced_spell_skill_level = skill_level;
-  v8->field_10 = a6;
+  v8->sound_id = spell_sound_id;
 LABEL_8:
   if ( result == 10 )
     result = -1;
@@ -2473,10 +2473,10 @@
   //signed int v16; // eax@53
   Player *v17; // esi@70
   //int v18; // eax@72
-  int v19; // eax@74
+  //int v19; // eax@74
   char *v20; // eax@74
   signed int i; // esi@76
-  int v22; // eax@88
+  //int v22; // eax@88
   __int16 v23; // ax@88
   //int v24; // ecx@93
   //int v25; // ecx@94
@@ -2488,26 +2488,26 @@
   //int v31; // eax@112
   //int v32; // eax@112
   //char *v33; // edx@113
-  int v34; // eax@121
+  //int v34; // eax@121
   int v35; // eax@123
   int v36; // edx@125
-  int v37; // eax@129
+  //int v37; // eax@129
   signed int v38; // edi@129
   signed int v39; // eax@129
   int v40; // ecx@129
   int v41; // eax@129
   signed int v42; // eax@129
   int *v43; // ecx@129
-  int v44; // eax@132
+  //int v44; // eax@132
   int v45; // ecx@132
   int v46; // eax@132
   unsigned int v47; // edx@133
   int v48; // eax@137
-  int v49; // eax@137
+  //int v49; // eax@137
   //int v50; // eax@141
   int v51; // eax@146
   __int16 v52; // ax@153
-  int v53; // eax@153
+  //int v53; // eax@153
   signed __int64 v54; // qax@164
   int v55; // edi@164
   //stru6 *v56; // eax@165
@@ -2516,7 +2516,7 @@
   int v59; // edi@177
   unsigned __int16 v60; // ax@184
   int v61; // ecx@184
-  int v62; // eax@186
+  //int v62; // eax@186
   int v63; // ecx@187
   int v64; // ecx@188
   int v65; // ecx@189
@@ -2615,7 +2615,7 @@
   double v158; // st7@326
   double v159; // st6@326
   signed __int64 v160; // qtt@334
-  int v161; // eax@339
+  //int v161; // eax@339
   int v162; // edi@340
   int v163; // eax@340
   signed int v164; // eax@340
@@ -2641,7 +2641,7 @@
   int v184; // ecx@358
   int v185; // ecx@359
   int v186; // ecx@360
-  int v187; // eax@367
+  //int v187; // eax@367
   int v188; // esi@369
   int v189; // edi@369
   //const char *v190; // ecx@377
@@ -2680,7 +2680,7 @@
   char v223; // al@438
   int v224; // ecx@442
   int v225; // ecx@443
-  int v226; // eax@451
+  //int v226; // eax@451
   int v227; // esi@453
   unsigned int v228; // edi@454
   int v229; // edi@466
@@ -2781,7 +2781,7 @@
   char *v324; // eax@635
   Player *v325; // ecx@640
   int v326; // eax@643
-  int v327; // eax@648
+  //int v327; // eax@648
   int v328; // ecx@651
   int v329; // ecx@652
   int v330; // edi@654
@@ -2822,7 +2822,7 @@
   int v365; // ecx@699
   int v366; // eax@701
   //stru6 *v367; // eax@704
-  int v368; // eax@704
+  //int v368; // eax@704
   Actor *v369; // edi@705
   int v370; // eax@706
   int v371; // ecx@709
@@ -2886,7 +2886,7 @@
   int v429; // ecx@826
   int v430; // eax@828
   //stru6 *v431; // eax@831
-  int v432; // eax@831
+  //int v432; // eax@831
   Actor *v433; // edi@832
   int v434; // eax@833
   int v435; // ecx@837
@@ -2960,7 +2960,7 @@
   //stru6 *v503; // eax@940
   //stru6 *v504; // eax@943
   int v505; // eax@943
-  int v506; // eax@943
+  //int v506; // eax@943
   int v507; // edi@944
   int v508; // eax@944
   signed int v509; // eax@944
@@ -2986,7 +2986,7 @@
   //__int16 v529; // ST18_2@975
   //stru6 *v530; // eax@975
   int v531; // eax@982
-  int v532; // eax@982
+  //int v532; // eax@982
   int v533; // edi@983
   int v534; // eax@983
   signed int v535; // eax@983
@@ -3034,7 +3034,7 @@
   Player *v577; // eax@1026
   int v578; // eax@1028
   __int16 v579; // ax@1029
-  int v580; // eax@1031
+  //int v580; // eax@1031
   int v581; // edi@1031
   int v582; // eax@1031
   //__int16 v583; // ST1C_2@1034
@@ -3049,7 +3049,7 @@
   int v592; // esi@1052
   int v593; // ecx@1057
   int v594; // ecx@1058
-  int v595; // eax@1064
+  //int v595; // eax@1064
   int v596; // esi@1066
   unsigned int v597; // edi@1067
   int v598; // eax@1079
@@ -3058,7 +3058,7 @@
   int v601; // edx@1086
   int v602; // eax@1086
   int v603; // ecx@1086
-  int v604; // eax@1087
+  //int v604; // eax@1087
   char *v605; // eax@1089
   int v606; // edx@1091
   int v607; // ecx@1100
@@ -3078,7 +3078,7 @@
   //__int16 v621; // ST18_2@1124
   //stru6 *v622; // eax@1124
   signed __int64 v623; // qax@1127
-  int v624; // eax@1127
+  //int v624; // eax@1127
   int v625; // edi@1129
   int v626; // eax@1129
   signed int v627; // eax@1129
@@ -3385,13 +3385,11 @@
         a1.uAttributes = 0;
         a1.uSpriteFrameID = 0;
         a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
-        v19 = 8 * v3->uPlayerID;
-        LOBYTE(v19) = v19 | OBJECT_Player;
-        a1.spell_caster_pid = v19;
-        a1.field_5C = a2;
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.spell_target_pid = a2;
         a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
         a1.uFacing = LOWORD(v715.uYawAngle);
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.uSoundID = LOWORD(v3->sound_id);
         v20 = (char *)&pParty->pPlayers[v3->uPlayerID];
         memcpy(&a1.stru_24, &v20[36 * *((int *)v20 + 1620) + 496], sizeof(a1.stru_24));
         a1.uAttributes = 256;
@@ -3424,13 +3422,11 @@
         a1.uAttributes = 0;
         a1.uSpriteFrameID = 0;
         a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
-        v22 = 8 * v3->uPlayerID;
-        LOBYTE(v22) = v22 | OBJECT_Player;
-        a1.spell_caster_pid = v22;
-        a1.field_5C = a2;
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.spell_target_pid = a2;
         a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
         a1.uFacing = LOWORD(v715.uYawAngle);
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.uSoundID = LOWORD(v3->sound_id);
         memcpy(
           &a1.stru_24,
           &pParty->pPlayers[v3->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36
@@ -3536,13 +3532,11 @@
                          pParty->vPosition.y,
                          pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
         a1.uSpriteFrameID = 0;
-        v34 = 8 * v3->uPlayerID;
-        LOBYTE(v34) = v34 | OBJECT_Player;
-        a1.spell_caster_pid = v34;
-        a1.field_5C = a2;
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.spell_target_pid = a2;
         a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
         a1.uFacing = LOWORD(v715.uYawAngle);
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.uSoundID = LOWORD(v3->sound_id);
         if ( pParty->bTurnBasedModeOn == 1 )
           LOBYTE(a1.uAttributes) |= 4u;
         v669 = v3->uPlayerID + 1;
@@ -3572,14 +3566,11 @@
         a1.uAttributes = 0;
         a1.uSectorID = 0;
         a1.uSpriteFrameID = 0;
-        v37 = v3->uPlayerID;
         a1.field_60_distance_related_prolly_lod = 0;
-        v37 *= 8;
-        LOBYTE(v37) = v37 | OBJECT_Player;
         a1.uFacing = 0;
-        a1.spell_caster_pid = v37;
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
         v38 = a2 >> 3;
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.uSoundID = LOWORD(v3->sound_id);
         v39 = a2 >> 3;
         a1.vPosition.x = pActors[v39].vPosition.x;
         v40 = pActors[v39].vPosition.y;
@@ -3587,7 +3578,7 @@
         v41 = 8 * (a2 >> 3);
         a1.vPosition.y = v40;
         LOBYTE(v41) = v41 | OBJECT_Actor;
-        a1.field_5C = v41;
+        a1.spell_target_pid = v41;
         v42 = a1.Create(0, 0, 0, 0);
         v43 = &v697;
         goto LABEL_133;
@@ -3611,21 +3602,16 @@
         a1.uAttributes = 0;
         a1.uSectorID = 0;
         a1.uSpriteFrameID = 0;
-        v44 = v3->uPlayerID;
         a1.field_60_distance_related_prolly_lod = 0;
         a1.uFacing = 0;
-        v44 *= 8;
-        LOBYTE(v44) = v44 | OBJECT_Player;
         v38 = (signed int)v726;
-        a1.spell_caster_pid = v44;
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.uSoundID = LOWORD(v3->sound_id);
         a1.vPosition.x = *(__int16 *)((char *)&pActors[0].vPosition.x + HIDWORD(v733));
         v45 = *(__int16 *)((char *)&pActors[0].vPosition.y + HIDWORD(v733));
         a1.vPosition.z = *(__int16 *)((char *)&pActors[0].vPosition.z + HIDWORD(v733));
-        v46 = 8 * (int)v726;
         a1.vPosition.y = v45;
-        LOBYTE(v46) = 8 * (char)v726 | OBJECT_Actor;
-        a1.field_5C = v46;
+        a1.spell_target_pid = PID(OBJECT_Actor, (int)v726);
         v42 = a1.Create(0, 0, 0, 0);
         v43 = &v704;
 LABEL_133:
@@ -3652,15 +3638,12 @@
         a1.uAttributes = 0;
         a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, v48);
         a1.uSpriteFrameID = 0;
-        v49 = 8 * v3->uPlayerID;
-        LOBYTE(v49) = v49 | OBJECT_Player;
-        a1.spell_caster_pid = v49;
-        a1.field_5C = a2;
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.spell_target_pid = a2;
         a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
         a1.uFacing = LOWORD(v715.uYawAngle);
-        LOWORD(v49) = LOWORD(v3->field_10);
         LOBYTE(a1.uAttributes) |= 0x80u;
-        a1.uSoundID = v49;
+        a1.uSoundID = LOWORD(v3->sound_id);
         v726 = (Player *)a1.Create(0, 0, 0, 0);
         if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) )
         {
@@ -3708,10 +3691,10 @@
 
         a1.uSpriteFrameID = 0;
         a1.spell_caster_pid = (8 * v3->uPlayerID) | OBJECT_Player;
-        a1.field_5C = a2;
+        a1.spell_target_pid = a2;
         a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
         a1.uFacing = LOWORD(v715.uYawAngle);
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.uSoundID = LOWORD(v3->sound_id);
         if ( pParty->bTurnBasedModeOn == 1 )
           LOBYTE(a1.uAttributes) |= 4u;
         if ( v3->spellnum == 18 )
@@ -3858,13 +3841,11 @@
                          pParty->vPosition.y,
                          pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
         a1.uSpriteFrameID = 0;
-        v62 = 8 * v3->uPlayerID;
-        LOBYTE(v62) = v62 | OBJECT_Player;
-        a1.spell_caster_pid = v62;
-        a1.field_5C = a2;
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.spell_target_pid = a2;
         a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
         a1.uFacing = LOWORD(v715.uYawAngle);
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.uSoundID = LOWORD(v3->sound_id);
         a1.spell_skill = v731;
         a1.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE;
         a1.spell_level = 300 * v2;
@@ -3941,7 +3922,7 @@
                           0,
                           -1,
                           0,
-                          v3->field_10,
+                          v3->sound_id,
                           0,
                           0);
                     }
@@ -4255,7 +4236,7 @@
             v121 = 8 * a2;
             a1.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v726 * unk_4D8548);
             LOBYTE(v121) = 8 * a2 | 3;
-            a1.field_5C = v121;
+            a1.spell_target_pid = v121;
             v122 = a1.Create(0, 0, 0, 0);
             DamageMonsterFromParty(8 * v122 | 2, v730, (Vec3_int_ *)&v701);
             LODWORD(v727) = 1;
@@ -4430,10 +4411,10 @@
             a1.vPosition.z = a2 + v713;
             a1.uSpriteFrameID = 0;
             a1.spell_caster_pid = 8 * v3->uPlayerID | OBJECT_Player;
-            a1.field_5C = v730;
+            a1.spell_target_pid = v730;
             a1.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500);
             a1.uFacing = v687;
-            a1.uSoundID = LOWORD(v3->field_10);
+            a1.uSoundID = LOWORD(v3->sound_id);
             if ( pParty->bTurnBasedModeOn == 1 )
               a1.uAttributes = 4;
             if ( a1.Create(
@@ -4474,13 +4455,10 @@
         a1.uAttributes = 0;
         a1.uSectorID = 0;
         a1.uSpriteFrameID = 0;
-        v161 = v3->uPlayerID;
         a1.field_60_distance_related_prolly_lod = 0;
         a1.uFacing = 0;
-        v161 *= 8;
-        LOBYTE(v161) = v161 | OBJECT_Player;
-        a1.spell_caster_pid = v161;
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.uSoundID = LOWORD(v3->sound_id);
         a2 = 0;
         if ( (signed int)v726 > 0 )
         {
@@ -4493,7 +4471,7 @@
             a1.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
             v163 = 8 * dword_50BF30[a2];
             LOBYTE(v163) = v163 | OBJECT_Actor;
-            a1.field_5C = v163;
+            a1.spell_target_pid = v163;
             v164 = a1.Create(0, 0, 0, 0);
             v165 = a2;
             DamageMonsterFromParty(8 * v164 | AI_OBJECT_LAYING_ITEM, dword_50BF30[a2], &v700);
@@ -4603,12 +4581,10 @@
                          pParty->vPosition.y,
                          pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
         a1.uSpriteFrameID = 0;
-        v187 = 8 * v3->uPlayerID;
-        LOBYTE(v187) = v187 | OBJECT_Player;
-        a1.spell_caster_pid = v187;
-        a1.field_5C = a2;
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.spell_target_pid = a2;
         a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.uSoundID = LOWORD(v3->sound_id);
         if ( pParty->bTurnBasedModeOn == 1 )
           LOBYTE(a1.uAttributes) |= 4u;
         v188 = (signed int)v726 / -2;
@@ -4797,10 +4773,10 @@
           a1.vPosition.z = (int)((char *)_this + LODWORD(v725));
           a1.uSpriteFrameID = 0;
           a1.spell_caster_pid = 8 * v3->uPlayerID | OBJECT_Player;
-          a1.field_5C = v730;
+          a1.spell_target_pid = v730;
           a1.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges);
           a1.uFacing = v685;
-          a1.uSoundID = LOWORD(v3->field_10);
+          a1.uSoundID = LOWORD(v3->sound_id);
           if ( pParty->bTurnBasedModeOn == 1 )
             a1.uAttributes = 4;
           if ( a1.Create(
@@ -4890,13 +4866,11 @@
           v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671);
           a1.uSpriteFrameID = 0;
           a1.uSectorID = v52;
-          v53 = 8 * v3->uPlayerID;
-          LOBYTE(v53) = v53 | OBJECT_Player;
-          a1.spell_caster_pid = v53;
-          a1.field_5C = a2;
+          a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+          a1.spell_target_pid = a2;
           a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
           a1.uFacing = LOWORD(v715.uYawAngle);
-          a1.uSoundID = LOWORD(v3->field_10);
+          a1.uSoundID = LOWORD(v3->sound_id);
 LABEL_154:
           if ( pParty->bTurnBasedModeOn == 1 )
             LOBYTE(a1.uAttributes) |= 4u;
@@ -4926,12 +4900,10 @@
                            pParty->vPosition.y,
                            pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
           a1.uSpriteFrameID = 0;
-          v226 = 8 * v3->uPlayerID;
-          LOBYTE(v226) = v226 | OBJECT_Player;
-          a1.spell_caster_pid = v226;
-          a1.field_5C = a2;
+          a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+          a1.spell_target_pid = a2;
           a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
-          a1.uSoundID = LOWORD(v3->field_10);
+          a1.uSoundID = LOWORD(v3->sound_id);
           if ( pParty->bTurnBasedModeOn == 1 )
             LOBYTE(a1.uAttributes) |= 4u;
           v227 = SHIDWORD(v733) / -2;
@@ -5487,7 +5459,7 @@
           _506348_current_lloyd_playerid = v3->uPlayerID;
           ::uRequiredMana = v319;
           ::sRecoveryTime = sRecoveryTime;
-          dword_50633C = v3->field_10;
+          dword_50633C = v3->sound_id;
           dword_506338 = v3->spellnum;
           LOBYTE(v3->field_8) |= 0x20u;
         }
@@ -5542,10 +5514,10 @@
         v326 = 8 * v3->uPlayerID;
         LOBYTE(v326) = v326 | OBJECT_Player;
         a1.spell_caster_pid = v326;
-        a1.field_5C = a2;
+        a1.spell_target_pid = a2;
         a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
         a1.uFacing = LOWORD(pParty->sRotationY);
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.uSoundID = LOWORD(v3->sound_id);
         if ( pParty->bTurnBasedModeOn == 1 )
           LOBYTE(a1.uAttributes) |= 4u;
         v669 = v3->uPlayerID + 1;
@@ -5573,13 +5545,11 @@
         a1.uSectorID = 0;
         a1.uSpriteFrameID = 0;
         a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
-        v327 = 8 * v3->uPlayerID;
-        LOBYTE(v327) = v327 | OBJECT_Player;
         a1.field_60_distance_related_prolly_lod = 0;
-        a1.spell_caster_pid = v327;
-        a1.field_5C = a2;
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.spell_target_pid = a2;
         a1.uFacing = LOWORD(pParty->sRotationY);
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.uSoundID = LOWORD(v3->sound_id);
         if ( pParty->bTurnBasedModeOn == 1 )
           a1.uAttributes = 4;
         v669 = 0;
@@ -5762,13 +5732,10 @@
         a1.uAttributes = 0;
         a1.uSectorID = 0;
         a1.uSpriteFrameID = 0;
-        v368 = v3->uPlayerID;
         a1.field_60_distance_related_prolly_lod = 0;
         a1.uFacing = 0;
-        v368 *= 8;
-        LOBYTE(v368) = v368 | OBJECT_Player;
-        a1.spell_caster_pid = v368;
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.uSoundID = LOWORD(v3->sound_id);
         for ( a2 = 0; a2 < (signed int)v726; ++a2 )
         {
           v369 = &pActors[dword_50BF30[a2]];
@@ -5780,7 +5747,7 @@
             a1.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
             v370 = 8 * dword_50BF30[a2];
             LOBYTE(v370) = v370 | OBJECT_Actor;
-            a1.field_5C = v370;
+            a1.spell_target_pid = v370;
             a1.Create(0, 0, 0, 0);
             v732 = (int)v733 << 7;
             v369->pActorBuffs[4].Apply(
@@ -6188,13 +6155,10 @@
         a1.uAttributes = 0;
         a1.uSectorID = 0;
         a1.uSpriteFrameID = 0;
-        v432 = v3->uPlayerID;
         a1.field_60_distance_related_prolly_lod = 0;
         a1.uFacing = 0;
-        v432 *= 8;
-        LOBYTE(v432) = v432 | OBJECT_Player;
-        a1.spell_caster_pid = v432;
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.uSoundID = LOWORD(v3->sound_id);
         for ( a2 = 0; a2 < (signed int)v726; ++a2 )
         {
           v433 = &pActors[dword_50BF30[a2]];
@@ -6206,7 +6170,7 @@
           a1.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
           v434 = 8 * dword_50BF30[a2];
           LOBYTE(v434) = v434 | OBJECT_Actor;
-          a1.field_5C = v434;
+          a1.spell_target_pid = v434;
           a1.Create(0, 0, 0, 0);
           if ( stru_50C198.GetMagicalResistance(v433, 7u) )
           {
@@ -6612,13 +6576,10 @@
         a1.uAttributes = 0;
         a1.uSectorID = 0;
         a1.uSpriteFrameID = 0;
-        v506 = v3->uPlayerID;
         a1.field_60_distance_related_prolly_lod = 0;
         a1.uFacing = 0;
-        v506 *= 8;
-        LOBYTE(v506) = v506 | OBJECT_Player;
-        a1.spell_caster_pid = v506;
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.uSoundID = LOWORD(v3->sound_id);
         a2 = 0;
         if ( SHIDWORD(v733) > 0 )
         {
@@ -6631,7 +6592,7 @@
             a1.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
             v508 = 8 * dword_50BF30[a2];
             LOBYTE(v508) = v508 | OBJECT_Actor;
-            a1.field_5C = v508;
+            a1.spell_target_pid = v508;
             v509 = a1.Create(0, 0, 0, 0);
             v510 = a2;
             DamageMonsterFromParty(8 * v509 | OBJECT_Item, dword_50BF30[a2], (Vec3_int_ *)&v688);
@@ -6648,7 +6609,7 @@
           a1.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
           v512 = 8 * dword_50BF30[a2];
           LOBYTE(v512) = v512 | OBJECT_Actor;
-          a1.field_5C = v512;
+          a1.spell_target_pid = v512;
           a1.Create(0, 0, 0, 0);
           v513 = v511->pActorBuffs;
           v726 = (Player *)22;
@@ -6777,13 +6738,10 @@
         a1.uAttributes = 0;
         a1.uSectorID = 0;
         a1.uSpriteFrameID = 0;
-        v532 = v3->uPlayerID;
         a1.field_60_distance_related_prolly_lod = 0;
         a1.uFacing = 0;
-        v532 *= 8;
-        LOBYTE(v532) = v532 | OBJECT_Player;
-        a1.spell_caster_pid = v532;
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.uSoundID = LOWORD(v3->sound_id);
         a2 = 0;
         if ( (signed int)v726 > 0 )
         {
@@ -6796,7 +6754,7 @@
             a1.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
             v534 = 8 * dword_50BF30[a2];
             LOBYTE(v534) = v534 | OBJECT_Actor;
-            a1.field_5C = v534;
+            a1.spell_target_pid = v534;
             v535 = a1.Create(0, 0, 0, 0);
             v536 = a2;
             DamageMonsterFromParty(8 * v535 | OBJECT_Item, dword_50BF30[a2], (Vec3_int_ *)&v694);
@@ -7007,21 +6965,17 @@
         a1.uAttributes = 0;
         a1.uSectorID = 0;
         a1.uSpriteFrameID = 0;
-        v580 = v3->uPlayerID;
         a1.field_60_distance_related_prolly_lod = 0;
         v581 = v721;
-        v580 *= 8;
-        LOBYTE(v580) = v580 | OBJECT_Player;
         a1.uFacing = 0;
-        a1.spell_caster_pid = v580;
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.uSoundID = LOWORD(v3->sound_id);
         a1.vPosition.x = *(short *)(v721 + 142);
         a1.vPosition.y = *(short *)(v721 + 144);
         v732 = *(short *)(v721 + 138);
         v582 = 8 * (int)v726;
         a1.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
-        LOBYTE(v582) = 8 * (char)v726 | OBJECT_Actor;
-        a1.field_5C = v582;
+        a1.spell_target_pid = PID(OBJECT_Actor, (int)v726);
         a1.Create(0, 0, 0, 0);
         if ( *(char *)(v581 + 52) > amount )
           goto play_sound_and_continue;
@@ -7120,12 +7074,10 @@
                          pParty->vPosition.y,
                          pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2);
         a1.uSpriteFrameID = 0;
-        v595 = 8 * v3->uPlayerID;
-        LOBYTE(v595) = v595 | OBJECT_Player;
-        a1.spell_caster_pid = v595;
-        a1.field_5C = a2;
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.spell_target_pid = a2;
         a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.uSoundID = LOWORD(v3->sound_id);
         if ( pParty->bTurnBasedModeOn == 1 )
           LOBYTE(a1.uAttributes) |= 4u;
         v596 = (signed int)v726 / -2;
@@ -7206,15 +7158,12 @@
         a1.uAttributes = 0;
         a1.uSectorID = pIndoor->GetSector(v657, v665, v676);
         a1.uSpriteFrameID = 0;
-        v604 = 8 * v3->uPlayerID;
-        LOBYTE(v604) = v604 | OBJECT_Player;
-        a1.spell_caster_pid = v604;
-        a1.field_5C = a2;
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.spell_target_pid = a2;
         a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
         a1.uFacing = LOWORD(v715.uYawAngle);
-        LOWORD(v604) = LOWORD(v3->field_10);
         LOBYTE(a1.uAttributes) |= 0x80u;
-        a1.uSoundID = v604;
+        a1.uSoundID = LOWORD(v3->sound_id);
         a1.Create(0, 0, 0, v3->uPlayerID + 1);
         goto LABEL_1056;
       case 96:
@@ -7344,13 +7293,10 @@
         a1.uAttributes = 0;
         a1.uSectorID = 0;
         a1.uSpriteFrameID = 0;
-        v624 = v3->uPlayerID;
         a1.field_60_distance_related_prolly_lod = 0;
         a1.uFacing = 0;
-        v624 *= 8;
-        LOBYTE(v624) = v624 | OBJECT_Player;
-        a1.spell_caster_pid = v624;
-        a1.uSoundID = LOWORD(v3->field_10);
+        a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
+        a1.uSoundID = LOWORD(v3->sound_id);
         a2 = 0;
         if ( SHIDWORD(v733) > 0 )
         {
@@ -7364,7 +7310,7 @@
             a1.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
             v626 = 8 * dword_50BF30[a2];
             LOBYTE(v626) = v626 | OBJECT_Actor;
-            a1.field_5C = v626;
+            a1.spell_target_pid = v626;
             v627 = a1.Create(0, 0, 0, 0);
             v628 = a2;
             DamageMonsterFromParty(8 * v627 | 2, dword_50BF30[a2], (Vec3_int_ *)&v707);
@@ -8180,7 +8126,7 @@
   a1a.uSectorID = pIndoor->GetSector(v21, y, z);
   a1a.uSpriteFrameID = 0;
   a1a.spell_caster_pid = 0;
-  a1a.field_5C = 0;
+  a1a.spell_target_pid = 0;
   if ( !(a1a.uAttributes & 0x10) )
   {
     v13 = 0;
@@ -8286,7 +8232,7 @@
   a1.uSectorID = pIndoor->GetSector(v3, v4, z);
   a1.uSpriteFrameID = 0;
   a1.spell_caster_pid = 0;
-  a1.field_5C = 0;
+  a1.spell_target_pid = 0;
   v8 = a1.Create(0, 0, 0, 0);
   if ( v8 != -1 )
   {
@@ -8346,7 +8292,7 @@
   a1a.uAttributes = 0;
   a1a.uSectorID = pIndoor->GetSector(v6, v7, a3);
   a1a.uSpriteFrameID = 0;
-  a1a.field_5C = 0;
+  a1a.spell_target_pid = 0;
   a1a.field_60_distance_related_prolly_lod = 0;
   a1a.uFacing = 0;
   a1a.uSoundID = 0;
--- a/stru277.h	Tue Mar 26 17:56:24 2013 +0200
+++ b/stru277.h	Tue Mar 26 20:05:57 2013 +0200
@@ -9,16 +9,16 @@
   //----- (00426987) --------------------------------------------------------
   inline stru277()
   {
-  this->field_8 = 0;
-  this->spellnum = 0;
-  this->field_6 = 0;
-  this->uPlayerID_2 = 0;
-  this->uPlayerID = 0;
-  this->field_10 = 0;
+    field_8 = 0;
+    spellnum = 0;
+    field_6 = 0;
+    uPlayerID_2 = 0;
+    uPlayerID = 0;
+    sound_id = 0;
   }
 
   void _427D48(unsigned int uPlayerID);
-  unsigned int PushStru277(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int a6);
+  unsigned int PushStru277(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int sound_id);
   struct GUIWindow *sub_4219BE();
   void _427E01_cast_spell();
 
@@ -29,7 +29,7 @@
   __int16 field_8;
   __int16 forced_spell_skill_level;
   int spell_target_pid;
-  int field_10;
+  int sound_id;
 };
 #pragma pack(pop)