changeset 545:dde1083df4b7

SubtractVariables
author Ritor1
date Sun, 03 Mar 2013 18:39:21 +0600
parents ec3546510fa1
children 0193f10fecbf
files Events.cpp mm7_2.cpp
diffstat 2 files changed, 41 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/Events.cpp	Sun Mar 03 15:57:58 2013 +0600
+++ b/Events.cpp	Sun Mar 03 18:39:21 2013 +0600
@@ -849,99 +849,62 @@
 				pValue = EVT_DWORD(_evt->v7);
 				if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands )
 				{
-					v64 = 0;
-					if ( pParty->pPickedItem.uItemID == pValue )
+					if ( pParty->pPickedItem.uItemID == pValue )//In hand
 					{
 						pMouse->RemoveHoldingItem();
 						++curr_seq_num;
 						v4 = v124;
-						
-						//v6 = v123;
-						//v7 = "";
 						break;
 					}
-					v65 = 0;
-					v66 = pPlayers[uActiveCharacter];
-					v67 = (int)v66->pInventoryIndices;
-					do
+					v67 = (int)pPlayers[uActiveCharacter]->pInventoryIndices;
+					for ( v65 = 0; v65 < 126; ++v65 )
 					{
-						if ( (int)&v66->pInventoryItems[v67] == pValue )
+						if ( (int)&pPlayers[uActiveCharacter]->pInventoryItems[v67] == pValue )
 						{
-							v66->RemoveItemAtInventoryIndex(v65);
+							pPlayers[uActiveCharacter]->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
+					v69 = (int)&pPlayers[uActiveCharacter]->pEquipment;
+					for ( v68 = 0; v68 < 16; ++v68 )
+					{
+						if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItems[v69] == pValue )
 						{
-							if ( *(int *)v69 && (int)&v66->pInventoryItems[v69] == pValue )
+							*(&pPlayers[uActiveCharacter]->pEquipment.uOffHand + v68) = 0;
+							++curr_seq_num;
+							v4 = v124;
+							break;
+						}
+						v69 += 4;
+					}
+					for (int i = 1; i < 5; i++)
+					{
+						v72 = (int)pPlayers[i]->pInventoryIndices;
+						for ( int v71 = 0; v71 < 126; ++v71 )
+						{
+							if ( (int)&pPlayers[i]->pInventoryItems[v72] == pValue )
 							{
-								*(&v66->pEquipment.uOffHand + v68) = 0;
-								++curr_seq_num;
-								v4 = v124;
-								
-								//v6 = v123;
-								//v7 = "";
+								pPlayers[i]->RemoveItemAtInventoryIndex(v71);
 								break;
 							}
-							++v68;
-							v69 += 4;
+							v72 += 4;
 						}
-						while ( v68 < 16 );
-							pPlayer = pPlayers[1];
-							while ( 1 )
-							{
-								v70 = pPlayer;
-								if ( !v64 )
-								{
-									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;
-LABEL_169:
-										v64 = 1;
-								}
-LABEL_170:
-								pPlayer += 4;
-								if ( pPlayer > pPlayers[4] )
-								{
-									//++curr_seq_num;
-									v4 = v124;
-									
-									//v6 = v123;
-									//v7 = "";
-									break;
-								}
-							}
+						v73 = 0;
+						v74 = (int)&pPlayers[i]->pEquipment;
+						while ( !*(int *)v74 || (int)&pPlayer->pInventoryItems[v74] != pValue )
+						{
+							++v73;
+							v74 += 4;
+							if ( v73 >= 16 )
+								break;
+						}
+						*(&pPlayers[i]->pEquipment.uOffHand + v73) = 0;
 					}
+				}
 				if ( player_choose <= 3 )
 				{
 					pPlayer = &pParty->pPlayers[player_choose];
@@ -961,10 +924,7 @@
 					for(int i = 0; i < 4; ++i)
 					{
 						if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
-						{
-							++curr_seq_num;
 							break;
-						}
 					}
 					++v130;
 				}
@@ -974,9 +934,9 @@
 					pPlayer = &pParty->pPlayers[player_choose];
 					pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
 				}
-                ++curr_seq_num;
-                v4 = v124;
-                break;
+				++curr_seq_num;
+				v4 = v124;
+				break;
 			case EVENT_Set:
 				pValue = EVT_DWORD(_evt->v7);
 				if ( player_choose <= 3 )
--- a/mm7_2.cpp	Sun Mar 03 15:57:58 2013 +0600
+++ b/mm7_2.cpp	Sun Mar 03 18:39:21 2013 +0600
@@ -13213,14 +13213,14 @@
   assert(sizeof(RenderD3D) == 0x148);
   assert(sizeof(Render) == 0x129844);
   assert(sizeof(Player) == 0x1B3C);
-  //assert(sizeof(Party_stru0) == 0x678);
-  //assert(sizeof(Party) == 0x16238);
+  assert(sizeof(Party_stru0) == 0x678);
+  assert(sizeof(Party) == 0x16238);
   assert(sizeof(GUIButton) == 0xBC);
   assert(sizeof(GUIWindow) == 0x54);
   assert(sizeof(GUIProgressBar) == 0x1B8);
   assert(sizeof(GUIFont) == 0x1020);
   assert(sizeof(stru262_TurnBased) == 0x40);
-  //assert(sizeof(ArcomageGame) == 0xFA);
+  assert(sizeof(ArcomageGame) == 0xFA);
   assert(sizeof(stru277) == 0x14);
   assert(sizeof(ArcomageCard) == 0x6C);
   assert(sizeof(stru320) == 0x3FC);