changeset 538:1d876589a030

Слияние
author Ritor1
date Sat, 02 Mar 2013 09:01:48 +0600
parents db4631a484ae (diff) 5196a51cc9ec (current diff)
children 75e80fc74045
files Events.cpp stru179.h
diffstat 4 files changed, 68 insertions(+), 92 deletions(-) [+]
line wrap: on
line diff
--- a/Chest.cpp	Sat Mar 02 01:37:06 2013 +0200
+++ b/Chest.cpp	Sat Mar 02 09:01:48 2013 +0600
@@ -79,7 +79,7 @@
 
   //a4 = uChestID;
   assert(uChestID < 20);
-  auto chest = pChests + uChestID;
+  auto chest = &pChests[uChestID];
 
   ++pIcons_LOD->uTexturePacksCount;
   if (!pIcons_LOD->uNumPrevLoadedFiles)
@@ -89,7 +89,7 @@
   //v1 = (char *)&pChests[uChestID].uFlags;
   //v34 = v1;
   if (!chest->Initialized())
-    Chest::_420284(uChestID);
+    Chest::PlacementItems(uChestID);
 
   if ( !uActiveCharacter )
     return 0;
@@ -220,7 +220,7 @@
     }
     pIcons_LOD->_4114F2();
     dword_507CD8 = 0;
-    return 0;
+    return false;
   }
   chest->SetInitialized(false);//*v1 &= 0xFEu;
   sRotY = 1;
@@ -233,26 +233,15 @@
       pPlayers[uActiveCharacter]->PlaySound(SPEECH_4, 0);
   }
   dword_507CD8 = 0;
-  v3 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Chest, a4, 0);
+  v3 = GUIWindow::Create(0, 0, 640, 480, WINDOW_Chest, uChestID, 0);
   pGUIWindow_CurrentMenu = v3;
   pChestWindow = v3;
-  pBtn_ExitCancel = v3->CreateButton(
-                 0x1D7u,
-                 0x1BDu,
-                 0xA9u,
-                 0x23u,
-                 1,
-                 0,
-                 0x71u,
-                 0,
-                 0,
-                 pGlobalTXT_LocalizationStrings[79],// Exit
-                 (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0),
-                 0);
+  pBtn_ExitCancel = v3->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79],// Exit
+                 (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 0);
   pChestWindow->CreateButton(7u, 8u, 460u, 343u, 1, 0, 0xCu, 0, 0, "", 0);
   pCurrentScreen = SCREEN_CHEST;
   pEventTimer->Pause();
-  return 1;
+  return true;
 }
 
 //----- (0042092D) --------------------------------------------------------
@@ -305,8 +294,7 @@
       if ( v6 > 0 )
       {
         v17 = v18 + 32 * v23 / v19;
-        v7 = pIcons_LOD->LoadTexture(
-               pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName,
+        v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[*(int *)((char *)&pChests[v3].mm7__vector_pItems[v6 - 1].uItemID)].pIconName,
                TEXTURE_16BIT_PALETTE);
         v8 = (Texture *)(v7 != -1 ? &pIcons_LOD->pTextures[v7] : 0);
         v9 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24);
@@ -627,7 +615,7 @@
 // 506128: using guessed type int areWeLoadingTexture;
 
 //----- (00420284) --------------------------------------------------------
-char *Chest::_420284(unsigned int uChestID)
+char *Chest::PlacementItems(unsigned int uChestID)
 {
   int v1; // ebx@1
   unsigned int v2; // esi@1
@@ -682,7 +670,7 @@
           if ( v6 >= uChestArea )
             break;
         }
-		if(v6<uChestArea)
+		if(v6 < uChestArea)
 		{
 			Chest::PlaceItemAt((unsigned __int8)Dst[v6], v11, v10);
 			if ( pChests[v3].uFlags & 4 )
--- a/Chest.h	Sat Mar 02 01:37:06 2013 +0200
+++ b/Chest.h	Sat Mar 02 09:01:48 2013 +0600
@@ -57,7 +57,7 @@
   static int _41FF64(unsigned int uChestID);
   static int _41FFA2(int a1, ItemGen *a2, unsigned int uChestID);
   static unsigned int PlaceItemAt(unsigned int a1, unsigned int uItemIdx, unsigned int uChestID);
-  static char *_420284(unsigned int uChestID);
+  static char *PlacementItems(unsigned int uChestID);
   static bool Open(unsigned int uChestID);
   static void DrawChestUI(unsigned int uChestID);
   static void ToggleFlag(unsigned int uChestID, unsigned __int16 uFlag, unsigned int bToggle);
--- a/Events.cpp	Sat Mar 02 01:37:06 2013 +0200
+++ b/Events.cpp	Sat Mar 02 09:01:48 2013 +0600
@@ -888,9 +888,6 @@
 						pMouse->RemoveHoldingItem();
 						++curr_seq_num;
 						v4 = v124;
-						
-						//v6 = v123;
-						//v7 = "";
 						break;
 					}
 					v65 = 0;
@@ -903,78 +900,69 @@
 							v66->RemoveItemAtInventoryIndex(v65);
 							++curr_seq_num;
 							v4 = v124;
-							
-							//v6 = v123;
-							//v7 = "";
 							break;
 						}
 						++v65;
 						v67 += 4;
 					}
 					while ( (signed int)v65 < 126 );
-						v68 = 0;
-						v69 = (int)&v66->pEquipment;
-						do
+					v68 = 0;
+					v69 = (int)&v66->pEquipment;
+					do
+					{
+						if ( *(int *)v69 && (int)&v66->pInventoryItems[v69] == pValue )
 						{
-							if ( *(int *)v69 && (int)&v66->pInventoryItems[v69] == pValue )
+							*(&v66->pEquipment.uOffHand + v68) = 0;
+							++curr_seq_num;
+							v4 = v124;
+							break;
+						}
+						++v68;
+						v69 += 4;
+					}
+					while ( v68 < 16 );
+					pPlayer = pPlayers[1];
+					while ( 1 )
+					{
+						v70 = pPlayer;
+						if ( !v64 )
+						{
+							v71 = 0;
+							v72 = (int)v70->pInventoryIndices;
+							do
 							{
-								*(&v66->pEquipment.uOffHand + v68) = 0;
-								++curr_seq_num;
-								v4 = v124;
-								
-								//v6 = v123;
-								//v7 = "";
-								break;
-							}
-							++v68;
-							v69 += 4;
-						}
-						while ( v68 < 16 );
-							pPlayer = pPlayers[1];
-							while ( 1 )
-							{
-								v70 = pPlayer;
-								if ( !v64 )
+								if ( (int)&v70->pInventoryItems[v72] == pValue )
 								{
-									v71 = 0;
-									v72 = (int)v70->pInventoryIndices;
-									do
-									{
-										if ( (int)&v70->pInventoryItems[v72] == pValue )
-										{
-											v70->RemoveItemAtInventoryIndex(v71);
-											goto LABEL_169;
-										}
-										++v71;
-										v72 += 4;
-									}
-									while ( (signed int)v71 < 126 );
-										v73 = 0;
-										v74 = (int)&v70->pEquipment;
-										while ( !*(int *)v74 || (int)&v70->pInventoryItems[v74] != pValue )
-										{
-											++v73;
-											v74 += 4;
-											if ( v73 >= 16 )
-												goto LABEL_170;
-										}
-										*(&v70->pEquipment.uOffHand + v73) = 0;
+									v70->RemoveItemAtInventoryIndex(v71);
+									goto LABEL_169;
+								}
+								++v71;
+								v72 += 4;
+							}
+							while ( (signed int)v71 < 126 );
+							v73 = 0;
+							v74 = (int)&v70->pEquipment;
+							while ( !*(int *)v74 || (int)&v70->pInventoryItems[v74] != pValue )
+							{
+								++v73;
+								v74 += 4;
+								if ( v73 >= 16 )
+									goto LABEL_170;
+							}
+							*(&v70->pEquipment.uOffHand + v73) = 0;
 LABEL_169:
-										v64 = 1;
-								}
+							v64 = 1;
+						}
 LABEL_170:
-								pPlayer += 4;
-								if ( pPlayer > pPlayers[4] )
-								{
-									//++curr_seq_num;
-									v4 = v124;
-									
-									//v6 = v123;
-									//v7 = "";
-									break;
-								}
-							}
+						pPlayer += 4;
+						if ( pPlayer > pPlayers[4] )
+						{
+							//++curr_seq_num;
+							v4 = v124;
+							break;
+						}
 					}
+				}
 				if ( player_choose <= 3 )
 				{
 					pPlayer = &pParty->pPlayers[player_choose];
@@ -1142,12 +1130,12 @@
 					+ (_evt->v10 != 0)));
 				goto LABEL_131;
 			case EVENT_ReceiveDamage:
-				v85 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+				v85 = EVT_DWORD(_evt->v7);
 				v86 = _evt->v5;
 				if ( (unsigned __int8)v86 <= 3u )
 					{
 					v119 = _evt->v6;
-					v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+					v115 = EVT_DWORD(_evt->v7);
 					v89 = (unsigned __int8)v86;
 					goto LABEL_233;
 					}
@@ -1164,13 +1152,13 @@
 						}
 					v119 = _evt->v6;
 					v88 = pPlayers[uActiveCharacter];
-					v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+					v115 = EVT_DWORD(_evt->v7);
 					goto LABEL_234;
 					}
 				if ( v86 != 5 )
 					{
 					v119 = _evt->v6;
-					v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10<< 8)) << 8)) << 8);
+					v115 = EVT_DWORD(_evt->v7);
 					v89 = rand() % 4;
 LABEL_233:
 					v88 = &pParty->pPlayers[v89];
--- a/MM7.vcxproj.filters	Sat Mar 02 01:37:06 2013 +0200
+++ b/MM7.vcxproj.filters	Sat Mar 02 09:01:48 2013 +0600
@@ -127,7 +127,6 @@
     <ClInclude Include="mm7_data.h" />
     <ClInclude Include="Allocator.h" />
     <ClInclude Include="IndoorCamera.h" />
-    <ClInclude Include="LayingItem.h" />
     <ClInclude Include="Viewport.h" />
     <ClInclude Include="MapInfo.h" />
     <ClInclude Include="PlayerFrameTable.h" />
@@ -202,6 +201,7 @@
     <ClInclude Include="resource.h" />
     <ClInclude Include="stru346.h" />
     <ClInclude Include="texts.h" />
+    <ClInclude Include="SpriteObject.h" />
   </ItemGroup>
   <ItemGroup>
     <Filter Include="lib">
@@ -258,7 +258,6 @@
     <ClCompile Include="stru6.cpp" />
     <ClCompile Include="AudioPlayer.cpp" />
     <ClCompile Include="GUIButton.cpp" />
-    <ClCompile Include="LayingItem.cpp" />
     <ClCompile Include="VideoPlayer.cpp" />
     <ClCompile Include="GUIProgressBar.cpp" />
     <ClCompile Include="TileFrameTable.h" />
@@ -321,6 +320,7 @@
     <ClCompile Include="texts.cpp" />
     <ClCompile Include="mm7text_ru.cpp" />
     <ClCompile Include="NPC.cpp" />
+    <ClCompile Include="SpriteObject.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Might and Magic Trilogy.rc" />