changeset 2029:81a0e6819d3f

Слияние
author Ritor1
date Mon, 18 Nov 2013 10:07:24 +0600
parents 136b4d8d36f6 (current diff) 3fa489e0a3f2 (diff)
children 47ab41698f9d
files
diffstat 7 files changed, 90 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/Events.cpp	Mon Nov 18 10:07:17 2013 +0600
+++ b/Events.cpp	Mon Nov 18 10:07:24 2013 +0600
@@ -945,7 +945,7 @@
          break;
       case EVENT_Substract:
         pValue = EVT_DWORD(_evt->v7);
-        if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands )
+        /*if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands )
         {
           if ( pParty->pPickedItem.uItemID == pValue )//In hand
           {
@@ -954,118 +954,113 @@
             v4 = v124;
             break;
           }
-          v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix.data();
+          //v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix.data();
           for ( v65 = 0; v65 < 126; ++v65 )
           {
-            if ( (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v67] == pValue )
+            v67 = &pPlayers[uActiveCharacter]->pInventoryMatrix[v65];
+            if ( v67 > 0 )
             {
-              pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65);
-              ++curr_seq_num;
-              v4 = v124;
-              break;
+              if ( pPlayers[uActiveCharacter]->pInventoryItemList[v67 - 1].uItemID == pValue )
+              {
+                pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65);
+                //++curr_seq_num;
+                //v4 = v124;
+                goto substract;
+              }
             }
-            v67 += 4;
+            //v67 += 4;
           }
-          while ( (signed int)v65 < 126 );
-          v69 = (int)&pPlayers[uActiveCharacter]->pEquipment;
+          //while ( (signed int)v65 < 126 );
+          //v69 = (int)&pPlayers[uActiveCharacter]->pEquipment.pIndices;
           for ( v68 = 0; v68 < 16; ++v68 )
           {
-            if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v69] == pValue )
+            if ( pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->pEquipment.pIndices[v68]].uItemID == pValue )
             {
-              *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v68) = 0;
-              ++curr_seq_num;
-              v4 = v124;
-              break;
+              pPlayers[uActiveCharacter]->pEquipment.pIndices[v68] = 0;
+              //++curr_seq_num;
+              //v4 = v124;
+              goto substract;
             }
-            v69 += 4;
+            //v69 += 4;
           }
           for (int i = 1; i < 5; i++)
           {
-            v72 = (int)pPlayers[i]->pInventoryMatrix.data();
+            //v72 = (int)pPlayers[i]->pInventoryMatrix.data();
             for ( int v71 = 0; v71 < 126; ++v71 )
             {
-              if ( (int)&pPlayers[i]->pInventoryItemList[v72] == pValue )
+              v72 = &pPlayers[i]->pInventoryMatrix[v71];
+              if ( v72 > 0 )
               {
-                pPlayers[i]->RemoveItemAtInventoryIndex(v71);
-                break;
+                if ( pPlayers[i]->pInventoryItemList[v72 - 1].uItemID == pValue )
+                {
+                  pPlayers[i]->RemoveItemAtInventoryIndex(v71);
+                  goto substract;
+                }
               }
-              v72 += 4;
+              //v72 += 4;
             }
-            v73 = 0;
-            v74 = (int)&pPlayers[i]->pEquipment;
-            while ( !*(int *)v74 || (int)&pPlayer->pInventoryItemList[v74] != pValue )
+            for ( v73 = 0; v73 < 16; ++v73 )
             {
-              ++v73;
-              v74 += 4;
-              if ( v73 >= 16 )
-                break;
+              //v74 = (int)&pPlayers[i]->pEquipment;
+              if (pPlayers[i]->pEquipment.pIndices[v73])
+              {
+                if (pPlayers[i]->pInventoryItemList[pPlayers[i]->pEquipment.pIndices[v73] - 1].uItemID == pValue )
+                {
+                  pPlayers[i]->pEquipment.pIndices[v73] = 0;
+                  //v74 += 4;
+                  goto substract;
+                }
+              }
             }
-            *(&pPlayers[i]->pEquipment.uShield + v73) = 0;
           }
-        }
+        }*/
         if ( player_choose <= 3 )
-        {
-          pPlayer = &pParty->pPlayers[player_choose];
-          pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-        }
+          pParty->pPlayers[player_choose].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         else if ( player_choose == 4 ) //active
         {
           if ( uActiveCharacter )
-          {
-            pPlayer = pPlayers[uActiveCharacter];
-            pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-          }
+            pPlayers[uActiveCharacter]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         }
         else  if ( player_choose == 5 )//all
         {
-          v130 = 0;
           for(int i = 1; i < 5; ++i)
           {
             pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
           }
-          ++v130;
         }
         else if ( player_choose == 6 ) //random
         {
           player_choose = rand() % 4;
-          pPlayer = &pParty->pPlayers[player_choose];
-          pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
+          pParty->pPlayers[player_choose].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         }
+//substract:
         ++curr_seq_num;
         v4 = v124;
         break;
       case EVENT_Set:
         pValue = EVT_DWORD(_evt->v7);
         if ( player_choose <= 3 )
-        {
-          pPlayer = &pParty->pPlayers[player_choose];
-          pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-        }
+          pParty->pPlayers[player_choose].SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         else if ( player_choose == 4 ) //active
         {
           if ( uActiveCharacter )
-          {
-            pPlayer = pPlayers[uActiveCharacter];
-            pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-          }
+            pPlayers[uActiveCharacter]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         }
         else if ( player_choose == 5 )//all
         {
                   //recheck v130
-          for(int i = 1; i < 5; ++i)
+          for ( int i = 1; i < 5; ++i )
             pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-
         }
         else if ( player_choose == 6 ) //random
         {
           player_choose = rand() % 4;
           pPlayer = &pParty->pPlayers[player_choose];
           pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-
         }
-                ++curr_seq_num;
-                v4 = v124;
-                break;
+        ++curr_seq_num;
+        v4 = v124;
+        break;
       case EVENT_Add:
         pValue = EVT_DWORD(_evt->v7);
         if ( player_choose <= 3 )
@@ -1076,34 +1071,28 @@
         else if ( player_choose == 4 ) //active
         {
           if ( uActiveCharacter )
-          {
-            pPlayer = pPlayers[uActiveCharacter];
-            pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-          }
+            pPlayers[uActiveCharacter]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         }
         else if ( player_choose == 5 )//all
         {
-          //v130 = 0;
           for(int i = 1; i < 5; ++i)
             pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-
         }
         else if ( player_choose == 6 ) //random
         {
           player_choose = rand() % 4;
-          pPlayer = &pParty->pPlayers[player_choose];
-          pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
+          pParty->pPlayers[player_choose].AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
         }
-                v83 = EVT_WORD(_evt->v5);
-                if (v83 == 21 ||  // gold well on emerald isle
-                    v83 == 22 || v83 == 23 || v83 == 24 )
-                {
-                  //__debugbreak(); // bonfire
-                    viewparams->bRedrawGameUI = true;
-                }
-                ++curr_seq_num;
-                v4 = v124;
-                break;
+        v83 = EVT_WORD(_evt->v5);
+        if (v83 == 21 ||  // gold well on emerald isle
+            v83 == 22 || v83 == 23 || v83 == 24 )
+        {
+          //__debugbreak(); // bonfire
+          viewparams->bRedrawGameUI = true;
+        }
+        ++curr_seq_num;
+        v4 = v124;
+        break;
       case EVENT_InputString:
         if ( !entry_line )
           {
--- a/GUIWindow.cpp	Mon Nov 18 10:07:17 2013 +0600
+++ b/GUIWindow.cpp	Mon Nov 18 10:07:24 2013 +0600
@@ -623,7 +623,7 @@
       memset(Journal_limitation_factor.data(), 0, 100);
       if ( books_primary_item_per_page < 29 )
       {
-        for ( int i = books_primary_item_per_page; i < books_primary_item_per_page + 31; i++ )
+        for ( int i = books_primary_item_per_page; i < books_primary_item_per_page + 29; i++ )
         {
           if ( pParty->PartyTimes.HistoryEventTimes[i] > 0 )
           {
--- a/Indoor.cpp	Mon Nov 18 10:07:17 2013 +0600
+++ b/Indoor.cpp	Mon Nov 18 10:07:24 2013 +0600
@@ -4000,7 +4000,7 @@
   for (uint i = 0; i < pSector->uNumFloors; ++i)
   {
     BLVFace* pFloor = &pIndoor->pFaces[pSector->pFloors[i]];
-    if (pFloor->Clickable())
+    if (pFloor->Ethereal())
       continue;
 
     assert(pFloor->uNumVertices);
--- a/Indoor.h	Mon Nov 18 10:07:17 2013 +0600
+++ b/Indoor.h	Mon Nov 18 10:07:24 2013 +0600
@@ -266,7 +266,7 @@
   inline bool Portal() const    {return (uAttributes & FACE_PORTAL) != 0;}
   inline bool Fluid() const     {return (uAttributes & FACE_FLUID) != 0;}
   inline bool Clickable() const {return (uAttributes & FACE_CLICKABLE) != 0;}
-
+  inline bool Ethereal() const {return (uAttributes & FACE_ETHEREAL) != 0;}
 
   struct Plane_float_ pFacePlane;
   struct Plane_int_ pFacePlane_old;
--- a/Party.cpp	Mon Nov 18 10:07:17 2013 +0600
+++ b/Party.cpp	Mon Nov 18 10:07:24 2013 +0600
@@ -1120,9 +1120,13 @@
     v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE);
     v21 = areWeLoadingTexture;
     v8 = 0;
+    uint current_player = uActiveCharacter;
     for (int i = 0; i < 4; i++)
     {
-      v9 = ::pPlayers[(uActiveCharacter + i) % 4];  //start with current active player, then cycle right if item won't fit
+     current_player = current_player + i;
+     if ( current_player > 4 )
+       current_player = current_player - 4;
+      v9 = ::pPlayers[current_player];
       v10 = v9->AddItem(-1, pItem->uItemID);
       if ( v10 )
       {
--- a/Player.cpp	Mon Nov 18 10:07:17 2013 +0600
+++ b/Player.cpp	Mon Nov 18 10:07:24 2013 +0600
@@ -6602,12 +6602,27 @@
       this->PlaySound(SPEECH_96, 0);
       return;
     case VAR_PlayerItemInHands:
+      for ( uint i = 0; i < 16; ++i )
+      {
+        int id_ = this->pEquipment.pIndices[i];
+        if ( id_ > 0 )
+        {
+          if ( this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID == pValue )
+          {
+            this->pEquipment.pIndices[i] = 0;
+          }
+        }
+      }
       for (int i = 0; i < 126; i++)
       {
-        if ( this->pInventoryItemList[pInventoryMatrix[i]].uItemID == pValue )
+        int id_ = this->pInventoryMatrix[i];
+        if ( id_ > 0 )
         {
-          RemoveItemAtInventoryIndex(i);
-          return;
+          if ( this->pInventoryItemList[id_ - 1].uItemID == pValue )
+          {
+            RemoveItemAtInventoryIndex(i);
+            return;
+          }
         }
       }
       if ( pParty->pPickedItem.uItemID == pValue )
--- a/UI/UiGame.cpp	Mon Nov 18 10:07:17 2013 +0600
+++ b/UI/UiGame.cpp	Mon Nov 18 10:07:24 2013 +0600
@@ -1234,7 +1234,7 @@
         if ( !pLevelDecorations[v19].uEventID )
         {
           if ( pLevelDecorations[v19].IsInteractive() )
-            pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 379].pTopic;//  
+            pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 380].pTopic;//-379
           else
             pText = pDecorationList->pDecorations[pLevelDecorations[v19].uDecorationDescID].field_20;
           GameUI_SetFooterString(pText);