changeset 1092:38890b8385e4

Merge
author Gloval
date Sun, 26 May 2013 14:13:43 +0400
parents 9c7eb4037567 (current diff) 8b59f13c9c3e (diff)
children c59ac5ea63f5 c40d40027b77
files
diffstat 6 files changed, 53 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sun May 26 14:13:22 2013 +0400
+++ b/Actor.cpp	Sun May 26 14:13:43 2013 +0400
@@ -1783,7 +1783,7 @@
   v20 = v6;
   v21 = PID_TYPE(v6);
   v22 = PID_ID(v20);
-  switch(v6)
+  switch(v21)
   {
 	case OBJECT_Item:
 		{
--- a/DecalBuilder.cpp	Sun May 26 14:13:22 2013 +0400
+++ b/DecalBuilder.cpp	Sun May 26 14:13:43 2013 +0400
@@ -383,7 +383,7 @@
     v39 = a8a;
     pGame->pIndoorCameraD3D->ViewTransform(a8a, (unsigned int)v13->uNumVertices);
     v40 = 0;
-    pGame->pIndoorCameraD3D->Project(v32, *v31, 0);
+    pGame->pIndoorCameraD3D->Project(v32, v13->uNumVertices, 0);
     if ( !(uClipFlags & 1) )
     {
       ++v12->field_308008;
--- a/SaveLoad.cpp	Sun May 26 14:13:22 2013 +0400
+++ b/SaveLoad.cpp	Sun May 26 14:13:43 2013 +0400
@@ -457,7 +457,7 @@
               data_write_pos += 4;
             }
       
-        for (int i = 0; i <= (signed int)uNumLevelDecorations; ++i)
+        for (int i = 0; i < (signed int)uNumLevelDecorations; ++i)
         {
           memcpy(data_write_pos, &pLevelDecorations[i].field_2, 2);
           data_write_pos += 2;
--- a/Spells.cpp	Sun May 26 14:13:22 2013 +0400
+++ b/Spells.cpp	Sun May 26 14:13:43 2013 +0400
@@ -24,7 +24,7 @@
 struct SpellStats *pSpellStats;
 
 
-stru324_spell stru_4E3ACC[100] =
+stru324_spell stru_4E3ACC[103] =
 {
   {10, 0},
   {1000, 0}, {1010, 0}, {1020, 0}, {1030, 0}, {1040, 0}, {1050, 0}, {1060, 0}, {1070, 0}, {1080, 0}, {1090, 0}, {1100, 0},
@@ -35,10 +35,10 @@
   {6000, 0}, {6010, 0}, {6020, 0}, {6030, 0}, {6040, 0}, {6050, 0}, {6060, 0}, {6070, 0}, {6080, 0}, {6090, 0}, {6100, 0},
   {7000, 0}, {7010, 0}, {7020, 0}, {7030, 0}, {7040, 0}, {7050, 0}, {7060, 0}, {7070, 0}, {7080, 0}, {7090, 0}, {7100, 0},
   {8000, 0}, {8010, 0}, {8020, 0}, {8030, 0}, {8040, 0}, {8050, 0}, {8060, 0}, {8070, 0}, {8080, 0}, {8090, 0}, {8100, 0},
-  {9000, 0}, {9010, 0}, {9020, 0}, {9030, 0}, {9040, 0}, {9050, 0}, {9060, 0}, {9070, 0}, {9080, 0}, {9090, 0}, {9100, 0}
-  //{545, 0},
-  //{545, 0},
-  //{555, 0}
+  {9000, 0}, {9010, 0}, {9020, 0}, {9030, 0}, {9040, 0}, {9050, 0}, {9060, 0}, {9070, 0}, {9080, 0}, {9090, 0}, {9100, 0},
+  {545, 0},
+  {545, 0},
+  {555, 0}
 };
  //9 spellbook pages  11 spells per page 9*11 =99 +1 zero struct at 0. It counted from 1!
 SpellData pSpellDatas[100]={
--- a/mm7_3.cpp	Sun May 26 14:13:22 2013 +0400
+++ b/mm7_3.cpp	Sun May 26 14:13:43 2013 +0400
@@ -1334,7 +1334,7 @@
 {
   unsigned int v0; // ebx@0
   //unsigned int v1; // edi@1
-  char *v2; // esi@2
+  //char *v2; // esi@2
   //__int16 v3; // dx@5
   ObjectDesc *v4; // eax@5
   int v5; // ecx@6
@@ -1359,7 +1359,7 @@
   for (uint i = 0; i < uNumSpriteObjects; ++i)
   {
     auto item = pSpriteObjects + i;
-    v2 = (char *)&item->uSpriteFrameID;
+    //v2 = (char *)&item->uSpriteFrameID;
     //do
     //{
       //LOWORD(v0) = item->uAttributes;
@@ -1372,20 +1372,22 @@
       if (item->AttachedToActor())
       {
           v5 = PID_ID(item->spell_target_pid);
-          *(int *)(v2 - 26) = pActors[v5].vPosition.x;
-          *(int *)(v2 - 22) = pActors[v5].vPosition.y;
-          *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight;
-          if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) )
-            goto LABEL_36;
+		  item->vPosition.x = pActors[v5].vPosition.x;
+          item->vPosition.y = pActors[v5].vPosition.y;
+          item->vPosition.z = pActors[v5].vPosition.z + pActors[v5].uActorHeight;
+		  if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID, item->uSpriteFrameID = v6, !(v4->uFlags & 4)) )
+            continue;
           if ( v6 >= 0 )
           {
             v7 = v4->uLifetime;
             if (item->uAttributes & 2)
-              v7 = *((short *)v2 + 1);
+              v7 = item->field_20;
             if ( v6 < v7 )
-              goto LABEL_36;
-          }
-          goto LABEL_34;
+              continue;
+          }
+            v10 = i;
+            SpriteObject::OnInteraction(v10);
+            continue;
       }
 
         if ( item->uObjectDescID )
@@ -1393,30 +1395,29 @@
           v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID;
           item->uSpriteFrameID = v8;
           v9 = v4->uFlags;
-          if ( !(v9 & 4) )
-            goto LABEL_22;
-          if ( v8 < 0 )
-          {
-            v10 = i;
-LABEL_35:
-            SpriteObject::OnInteraction(v10);
-            goto LABEL_36;
-          }
-          v11 = v4->uLifetime;
-          if (item->uAttributes & 2)
-            v11 = *((short *)v2 + 1);
-          if ( v8 < v11 )
-          {
-LABEL_22:
+          if ( v9 & 4 )
+		  {    
+			  if ( v8 < 0 )
+			  {
+				v10 = i;
+				SpriteObject::OnInteraction(v10);
+				continue;
+			  }
+			  v11 = v4->uLifetime;
+			  if (item->uAttributes & 2)
+				v11 = item->field_20;
+		  }
+		  if ( !(v9 & 4) || v8 < v11 )
+          {
             if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
               SpriteObject::UpdateObject_fn0_BLV(i);
             else
               SpriteObject::UpdateObject_fn0_ODM(i);
-            if ( pParty->bTurnBasedModeOn != 1 || !(*(v2 - 4) & 4) )
-              goto LABEL_36;
-            v12 = abs(pParty->vPosition.x - *(int *)(v2 - 26));
-            v18 = abs(pParty->vPosition.y - *(int *)(v2 - 22));
-            v19 = abs(pParty->vPosition.z - *(int *)(v2 - 18));
+			if ( pParty->bTurnBasedModeOn != 1 || !(item->uSectorID & 4) )
+              continue;
+			v12 = abs(pParty->vPosition.x - item->vPosition.x);
+			v18 = abs(pParty->vPosition.y - item->vPosition.y);
+			v19 = abs(pParty->vPosition.z - item->vPosition.z);
             v13 = v12;
             v14 = v18;
             v15 = v19;
@@ -1439,19 +1440,20 @@
             }
             v0 = (unsigned int)(11 * v14) >> 5;
             if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 )
-              goto LABEL_36;
-LABEL_34:
+              continue;
             v10 = i;
-            goto LABEL_35;
+            SpriteObject::OnInteraction(v10);
+            continue;
           }
           v10 = i;
           if ( !(v9 & 0x40) )
-            goto LABEL_35;
+		  {
+            SpriteObject::OnInteraction(v10);
+            continue;
+		  }
           _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i));
         }
     }
-LABEL_36:
-    ;
       //v2 += 112;
       //v1 = v20++ + 1;
     //}
@@ -4284,7 +4286,8 @@
       v33 = (double)v16 * 0.0000152587890625;
       //UNDEF(v17);
       v20 = *((float *)v15 - 1) - (double)pIndoorCamera->pos.x;
-      if ( v19 | v18 )
+      //if ( v19 | v18 )
+	  if(pIndoorCamera->pos.x == 0)
       {
         v27 = v20;
         LODWORD(v35) = *((int *)v15 + 1);
--- a/mm7_6.cpp	Sun May 26 14:13:22 2013 +0400
+++ b/mm7_6.cpp	Sun May 26 14:13:43 2013 +0400
@@ -3041,7 +3041,7 @@
 			pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x;
 			pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y;
 			pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z;
-			pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726);
+			pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2));
 			auto obj_id = pSpellSprite.Create(0, 0, 0, 0);
 			DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704);
 			LODWORD(v727) = 1;
@@ -3490,7 +3490,7 @@
 				LODWORD(v727) = 1;
 				do
 				{
-					if ( v92->pConditions )
+					if ( v92->pConditions[1] )
 						LODWORD(v727) = 0;
 					++v92;
 				}
@@ -3757,7 +3757,7 @@
 					pSpellSprite.vPosition.x = uRequiredMana;
 					pSpellSprite.vPosition.y = LODWORD(v727);
 					pSpellSprite.uSectorID = 0;
-					pSpellSprite.vPosition.z = a2 + v713;
+					pSpellSprite.vPosition.z = a2 + v154;
 					pSpellSprite.uSpriteFrameID = 0;
 					pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
 					pSpellSprite.spell_target_pid = v730;
@@ -4195,7 +4195,7 @@
 				pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
 				if ( pParty->bTurnBasedModeOn == 1 )
 					LOBYTE(pSpellSprite.uAttributes) |= 4u;
-				v227 = SHIDWORD(v733) / -2;
+				v227 = _v733 / -2;
 				signed int _y = _v733 / 2;
 				if ( _v733 / -2 <= _v733 / 2 )
 				{