changeset 2191:48a28fe1f32f

pInventoryItemList->Reset()
author Ritor1
date Thu, 30 Jan 2014 17:41:54 +0600
parents 0acbf1f82c70
children c13ae8d8471f
files CastSpellInfo.cpp LOD.cpp Player.cpp Render.cpp mm7_2.cpp mm7_7.cpp
diffstat 6 files changed, 27 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/CastSpellInfo.cpp	Wed Jan 29 22:08:04 2014 +0600
+++ b/CastSpellInfo.cpp	Thu Jan 30 17:41:54 2014 +0600
@@ -102,7 +102,7 @@
   int dist_Y; // [sp+DD8h] [bp-ACh]@163
   int v723; // [sp+E4Ch] [bp-38h]@1
   ItemGen *_this; // [sp+E50h] [bp-34h]@23
-  float v725; // [sp+E54h] [bp-30h]@23
+  int v725; // [sp+E54h] [bp-30h]@23
   int buff_resist;
   bool spell_sound_flag; // [sp+E5Ch] [bp-28h]@1
   Player *pPlayer; // [sp+E64h] [bp-20h]@8
@@ -174,7 +174,7 @@
       }
     }
 
-    LODWORD(v725) = 0;
+    v725 = 0;
     _this = 0;
     if (pCastSpell->forced_spell_skill_level)
     {
@@ -207,10 +207,10 @@
         v667 = PLAYER_SKILL_BOW;
       else assert(false && "Unknown spell");
 
-      LODWORD(v725) = v667;
+      v725 = v667;
       v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F;
       spell_level = v723;
-      v11 = pPlayer->pActiveSkills[LODWORD(v725)];
+      v11 = pPlayer->pActiveSkills[v725];
     }
 
     skill_level = SkillToMastery(v11);
@@ -218,11 +218,11 @@
     if (pCastSpell->forced_spell_skill_level)
       uRequiredMana = 0;
     else 
-      uRequiredMana = pSpellDatas[pCastSpell->uSpellID].mana_per_skill[skill_level - 1];
-    sRecoveryTime = pSpellDatas[pCastSpell->uSpellID].recovery_per_skill[skill_level - 1];
+      uRequiredMana = pSpellDatas[pCastSpell->uSpellID - 1].mana_per_skill[skill_level - 1];
+    sRecoveryTime = pSpellDatas[pCastSpell->uSpellID - 1].recovery_per_skill[skill_level - 1];
 
-    if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 ||
-        LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0)
+    if (v725 == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 ||
+        v725 == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0)
       uRequiredMana = 0;
 
     if (pCastSpell->uSpellID < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana)
@@ -1606,7 +1606,7 @@
                 else if ( skill_level == 3 || skill_level == 4)//мастер и гранд
                 {
                   v258 = 0;
-                  v725 = 0.0;
+                  v725 = 0;
                   int _v733;
                   if ( pItemsTable->pSpecialEnchantments_count > 0 )
                   {
@@ -1617,7 +1617,7 @@
                       if ( !v259 || v259 == 1 )
                       {
                         v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[v245->GetItemEquipType() + 4] + v258 * 28);
-                        LODWORD(v725) += v260;
+                        v725 += v260;
                         if ( v260 )
                         {
                           v261 = v730;
@@ -1628,7 +1628,7 @@
                       ++v258;
                     }
                   }
-                  v262 = rand() % SLODWORD(v725);
+                  v262 = rand() % v725;
                   v263 = v679;
                   v245->uSpecEnchantmentType = v679[0];
                   v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[v245->GetItemEquipType() + 4];
@@ -1647,7 +1647,7 @@
                     }
                   }
                   v278 = 0;
-                  v725 = 0.0;
+                  v725 = 0;
                   if ( pItemsTable->pSpecialEnchantments_count > 0 )
                   {
                     int *_v730 = v679;
--- a/LOD.cpp	Wed Jan 29 22:08:04 2014 +0600
+++ b/LOD.cpp	Thu Jan 30 17:41:54 2014 +0600
@@ -1668,7 +1668,10 @@
   else
     pFile = fopen(pFilename, "rb+");
   if (!pFile)
+  {
+	  __debugbreak();
     return false;// возможно файл не закрыт, поэтому не открывается
+  }
 
   strcpy(pLODName, pFilename);
   fread(&header, sizeof(LOD::FileHeader), 1, pFile);
@@ -1774,7 +1777,7 @@
   if ( pFile )
   {
     strcpy(pLODName, pFilename);
-    fread(&header, sizeof(LOD::FileHeader), 1u, pFile);
+    fread(&header, sizeof(LOD::FileHeader), 1, pFile);
     pRoot = (LOD::Directory *)malloc(160);
     if ( pRoot )
     {
--- a/Player.cpp	Wed Jan 29 22:08:04 2014 +0600
+++ b/Player.cpp	Thu Jan 30 17:41:54 2014 +0600
@@ -4014,6 +4014,13 @@
     }
   }
 
+  memset(&pEquipment, 0, sizeof(PlayerEquipment));
+  pInventoryMatrix.fill(0);
+  for (uint i = 0; i < 126; ++i)
+    pInventoryItemList[i].Reset();
+  for (uint i = 0; i < 12; ++i)
+    pEquippedItems[i].Reset();
+
   sHealth = GetMaxHealth();
   sMana = GetMaxMana();
 }
--- a/Render.cpp	Wed Jan 29 22:08:04 2014 +0600
+++ b/Render.cpp	Thu Jan 30 17:41:54 2014 +0600
@@ -8656,7 +8656,7 @@
     {
       if ( next_vertices_flag )
       {
-        //t = neer_clip - v0.x / v1.x - v0.x    (формула получения точки пересечения отрезка с плоскостью)
+        //t = near_clip - v0.x / v1.x - v0.x    (формула получения точки пересечения отрезка с плоскостью)
         t = (8.0 - array_50AC10[i].vWorldViewPosition.x) / (array_50AC10[i + 1].vWorldViewPosition.x - array_50AC10[i].vWorldViewPosition.x);
         array_507D30[out_num_vertices].vWorldViewPosition.y = (array_50AC10[i + 1].vWorldViewPosition.y - array_50AC10[i].vWorldViewPosition.y) * t + array_50AC10[i].vWorldViewPosition.y;
         array_507D30[out_num_vertices].vWorldViewPosition.z = (array_50AC10[i + 1].vWorldViewPosition.z - array_50AC10[i].vWorldViewPosition.z) * t + array_50AC10[i].vWorldViewPosition.z;
--- a/mm7_2.cpp	Wed Jan 29 22:08:04 2014 +0600
+++ b/mm7_2.cpp	Thu Jan 30 17:41:54 2014 +0600
@@ -4200,7 +4200,7 @@
   uCPUSpeed = Rect.bottom;*/
   uCPUSpeed = 2048; // about 2GHz
 
-  //constructors();
+  constructors();
 
   if (!MM7_Initialize(640, 480))
   {
--- a/mm7_7.cpp	Wed Jan 29 22:08:04 2014 +0600
+++ b/mm7_7.cpp	Thu Jan 30 17:41:54 2014 +0600
@@ -25,7 +25,7 @@
   dword_4F8580[0] = 1;
   return result;
   */
-	__debugbreak();//Ritor1
+	//__debugbreak();//Ritor1
   for( int i = 0; i < 62; i++ )
   {
 	  dword_4F8580[i] = 0;
@@ -37,7 +37,7 @@
 //----- (00423B4A) --------------------------------------------------------
 void  sub_423B4A()
 {
-	__debugbreak();//Ritor1
+	//__debugbreak();//Ritor1
   for ( uint i = 0; i < 50; i++ )
     array_507D30[i].flt_2C = 0.0;
 }