diff mm7_1.cpp @ 586:3c7fca0e01a0

sub_41CD4F clean
author zipi
date Wed, 06 Mar 2013 12:02:40 +0000
parents 3ac7059a3f4f
children fb0e105683e9 c615ff03b144
line wrap: on
line diff
--- a/mm7_1.cpp	Wed Mar 06 11:39:35 2013 +0000
+++ b/mm7_1.cpp	Wed Mar 06 12:02:40 2013 +0000
@@ -1933,242 +1933,232 @@
     v3 = pVisibleWindowsIdxs[v27] - 1;
     if ( pWindowList[v3].field_44 != v1 )
 	{
-		if ( v26 != 34 )
+		switch(v26)
 		{
-		  if ( v26 == 37 )
-		  {
-			v12 = pWindowList[v3].field_34;
-			if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 )
-			{
-			  v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
-			  pWindowList[v3].pCurrentPosActiveItem -= v12;
-			  if ( v8 )
-			  {
-				pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1);
-				v2 = pMessageQueue_50CBD0->uNumMessages;
-			  }
-			}
-			if ( pWindowList[v3].field_30 != v1 )
-			{
-				--v27;
-				if ( v27 < 0 )
-				  return 0;
-				continue;
-			}
-			v9 = pWindowList[v3].pControlsHead;
-			v13 = pWindowList[v3].pCurrentPosActiveItem;
-			if ( v13 > (signed int)v1 )
-			{
-			  do
-			  {
-				v9 = v9->pNext;
-				--v13;
-			  }
-			  while ( v13 );
-			}
-			v11 = v9->uControlParam;
-			/*if ( (signed int)v2 < 40 )
-			{
-			  pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v9->uControlID;
-			  pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v11;
-			  *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
-			  v2 = pMessageQueue_50CBD0->uNumMessages + 1;
-			  ++pMessageQueue_50CBD0->uNumMessages;
-			}*/
-			pMessageQueue_50CBD0->AddMessage((UIMessageType)v9->uControlID, v11, v1);
-			--v27;
-			if ( v27 < 0 )
-				return 0;
-			continue;
-		  }
-		  if ( v26 != 38 )
-		  {
-			if ( v26 == 39 )
-			{
-			  v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34;
-			  if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem )
-			  {
-				v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
-				pWindowList[v3].pCurrentPosActiveItem = v7;
-				if ( v8 )
+			case VK_LEFT:
+				{
+				v12 = pWindowList[v3].field_34;
+				if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 )
+				{
+				  v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
+				  pWindowList[v3].pCurrentPosActiveItem -= v12;
+				  if ( v8 )
+				  {
+					pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1);
+					v2 = pMessageQueue_50CBD0->uNumMessages;
+				  }
+				}
+				if ( pWindowList[v3].field_30 != v1 )
 				{
-				  pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1);
-				  v2 = pMessageQueue_50CBD0->uNumMessages;
+					break;
+				}
+				v9 = pWindowList[v3].pControlsHead;
+				v13 = pWindowList[v3].pCurrentPosActiveItem;
+				if ( v13 > (signed int)v1 )
+				{
+				  do
+				  {
+					v9 = v9->pNext;
+					--v13;
+				  }
+				  while ( v13 );
+				}
+				v11 = v9->uControlParam;
+				/*if ( (signed int)v2 < 40 )
+				{
+				  pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v9->uControlID;
+				  pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v11;
+				  *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
+				  v2 = pMessageQueue_50CBD0->uNumMessages + 1;
+				  ++pMessageQueue_50CBD0->uNumMessages;
+				}*/
+				pMessageQueue_50CBD0->AddMessage((UIMessageType)v9->uControlID, v11, v1);
+				break;
 				}
-			  }
-			  if ( pWindowList[v3].field_30 != v1 )
-			  {
-				--v27;
-				if ( v27 < 0 )
-				  return 0;
-				continue;
-			  }
-			  v9 = pWindowList[v3].pControlsHead;
-			  v10 = pWindowList[v3].pCurrentPosActiveItem;
-			  if ( v10 > (signed int)v1 )
-			  {
-				do
+			case VK_RIGHT:
+				{
+				v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34;
+				if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem )
 				{
-				  v9 = v9->pNext;
-				  --v10;
+					v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
+					pWindowList[v3].pCurrentPosActiveItem = v7;
+					if ( v8 )
+					{
+						pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1);
+						v2 = pMessageQueue_50CBD0->uNumMessages;
+					}
+				}
+				if ( pWindowList[v3].field_30 != v1 )
+				{
+					break;
 				}
-				while ( v10 );
-			  }
-			  v11 = v9->uControlParam;
-			  pMessageQueue_50CBD0->AddMessage((UIMessageType)v9->uControlID, v11, v1);
-			  --v27;
-			  if ( v27 < 0 )
-			    return 0;
-			  continue;
-			}
-			if ( v26 == 40 )
-			{
-			  v17 = pWindowList[v3].pStartingPosActiveItem;
-			  v18 = pWindowList[v3].pCurrentPosActiveItem;
-			  if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 )
-				pWindowList[v3].pCurrentPosActiveItem = v17;
-			  else
-				pWindowList[v3].pCurrentPosActiveItem = v18 + 1;
-			  if ( pWindowList[v3].field_30 != v1 )
-				return 1;
-			  v19 = pWindowList[v3].pControlsHead;
-			  v20 = pWindowList[v3].pCurrentPosActiveItem;
-			  if ( v20 > (signed int)v1 )
-			  {
-				do
+				v9 = pWindowList[v3].pControlsHead;
+				v10 = pWindowList[v3].pCurrentPosActiveItem;
+				if ( v10 > (signed int)v1 )
 				{
-				  v19 = v19->pNext;
-				  --v20;
+					do
+					{
+						v9 = v9->pNext;
+						--v10;
+					}
+					while ( v10 );
+				}
+				v11 = v9->uControlParam;
+				pMessageQueue_50CBD0->AddMessage((UIMessageType)v9->uControlID, v11, v1);
+				break;				
 				}
-				while ( v20 );
-			  }
-			  v21 = v19->uControlParam;
-			  pMessageQueue_50CBD0->AddMessage((UIMessageType)v19->uControlID, v21, v1);
-			  return 1;
-			}
-			if ( v26 == 41 )
-			{
-			  pMouse->GetClickPos(&uClickX, &uClickY);
-			  v4 = pWindowList[v3].pStartingPosActiveItem;
-			  v28 = v4 + pWindowList[v3].pNumPresenceButton;
-			  if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
-			  {
-				while ( 1 )
+			case VK_DOWN:
 				{
-				  v5 = pWindowList[v3].pControlsHead;
-				  if ( v4 > 0 )
-				  {
-					v6 = v4;
+				v17 = pWindowList[v3].pStartingPosActiveItem;
+				v18 = pWindowList[v3].pCurrentPosActiveItem;
+				if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 )
+					pWindowList[v3].pCurrentPosActiveItem = v17;
+				else
+					pWindowList[v3].pCurrentPosActiveItem = v18 + 1;
+				if ( pWindowList[v3].field_30 != v1 )
+					return 1;
+				v19 = pWindowList[v3].pControlsHead;
+				v20 = pWindowList[v3].pCurrentPosActiveItem;
+				if ( v20 > (signed int)v1 )
+				{
 					do
 					{
-					  v5 = v5->pNext;
-					  --v6;
+						v19 = v19->pNext;
+						--v20;
 					}
-					while ( v6 );
-				  }
-				  if ( (signed int)uClickX >= (signed int)v5->uX
-					&& (signed int)uClickX <= (signed int)v5->uZ
-					&& (signed int)uClickY >= (signed int)v5->uY
-					&& (signed int)uClickY <= (signed int)v5->uW )
-					break;
-				  ++v4;
-				  if ( v4 >= v28 )
-				  {
-					v1 = 0;
-				    v2 = pMessageQueue_50CBD0->uNumMessages;
-				    --v27;
-				    if ( v27 < 0 )
-  					  return 0;
-				    continue;
-				  }
+					while ( v20 );
 				}
-				pWindowList[v3].pCurrentPosActiveItem = v4;
+				v21 = v19->uControlParam;
+				pMessageQueue_50CBD0->AddMessage((UIMessageType)v19->uControlID, v21, v1);
 				return 1;
-			  }
-			  v2 = pMessageQueue_50CBD0->uNumMessages;
-			  --v27;
-			  if ( v27 < 0 )
-			    return 0;
-			  continue;
-			}
-			--v27;
-			if ( v27 < 0 )
-			return 0;
-			continue;
-		  }
-		  v22 = pWindowList[v3].pCurrentPosActiveItem;
-		  v23 = pWindowList[v3].pStartingPosActiveItem;
-		  if ( v22 <= v23 )
-			v24 = pWindowList[v3].pNumPresenceButton + v23 - 1;
-		  else
-			v24 = v22 - 1;
-		  v8 = pWindowList[v3].field_30 == v1;
-		  pWindowList[v3].pCurrentPosActiveItem = v24;
-		  if ( !v8 )
-			return 1;
-		  v19 = pWindowList[v3].pControlsHead;
-		  v25 = pWindowList[v3].pCurrentPosActiveItem;
-		  if ( v25 > (signed int)v1 )
-		  {
-			do
-			{
-			  v19 = v19->pNext;
-			  --v25;
-			}
-			while ( v25 );
-		  }
-		  v21 = v19->uControlParam;
-		  /*if ( (signed int)v2 < 40 )
-		  {
-			pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v19->uControlID;
-			pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v21;
-			*(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
-			++pMessageQueue_50CBD0->uNumMessages;
-		  }*/
-		  pMessageQueue_50CBD0->AddMessage((UIMessageType)v19->uControlID, v21, v1);
-		  return 1;
-		}
-		if ( pWindowList[v3].field_30 != v1 )
-		{
-		  pMouse->GetClickPos(&uClickX, &uClickY);
-		  v4 = pWindowList[v3].pStartingPosActiveItem;
-		  v29 = v4 + pWindowList[v3].pNumPresenceButton;
-		  if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
-		  {
-			while ( 1 )
-			{
-			  v14 = pWindowList[v3].pControlsHead;
-			  if ( v4 > 0 )
-			  {
-				v15 = v4;
-				do
+				}
+			case VK_SELECT:
+				{
+				pMouse->GetClickPos(&uClickX, &uClickY);
+				v4 = pWindowList[v3].pStartingPosActiveItem;
+				v28 = v4 + pWindowList[v3].pNumPresenceButton;
+				if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
+				{
+					while ( 1 )
+					{
+						v5 = pWindowList[v3].pControlsHead;
+						if ( v4 > 0 )
+						{
+							v6 = v4;
+							do
+							{
+								v5 = v5->pNext;
+								--v6;
+							}
+							while ( v6 );
+						}
+						if ( (signed int)uClickX >= (signed int)v5->uX
+						&& (signed int)uClickX <= (signed int)v5->uZ
+						&& (signed int)uClickY >= (signed int)v5->uY
+						&& (signed int)uClickY <= (signed int)v5->uW )
+							break;
+						++v4;
+						if ( v4 >= v28 )
+						{
+							v1 = 0;
+							v2 = pMessageQueue_50CBD0->uNumMessages;
+							--v27;
+							if ( v27 < 0 )
+  								return 0;
+							continue;
+						}
+					}
+					pWindowList[v3].pCurrentPosActiveItem = v4;
+					return 1;
+				}
+				v2 = pMessageQueue_50CBD0->uNumMessages;
+				break;
+				}
+			case VK_UP:
+				{
+				v22 = pWindowList[v3].pCurrentPosActiveItem;
+				v23 = pWindowList[v3].pStartingPosActiveItem;
+				if ( v22 <= v23 )
+					v24 = pWindowList[v3].pNumPresenceButton + v23 - 1;
+				else
+					v24 = v22 - 1;
+				v8 = pWindowList[v3].field_30 == v1;
+				pWindowList[v3].pCurrentPosActiveItem = v24;
+				if ( !v8 )
+					return 1;
+				v19 = pWindowList[v3].pControlsHead;
+				v25 = pWindowList[v3].pCurrentPosActiveItem;
+				if ( v25 > (signed int)v1 )
 				{
-				  v14 = v14->pNext;
-				  --v15;
+					do
+					{
+						v19 = v19->pNext;
+						--v25;
+					}
+					while ( v25 );
 				}
-				while ( v15 );
-			  }
-			  if ( (signed int)uClickX >= (signed int)v14->uX
-				&& (signed int)uClickX <= (signed int)v14->uZ
-				&& (signed int)uClickY >= (signed int)v14->uY
-				&& (signed int)uClickY <= (signed int)v14->uW )
-			  {
-				pWindowList[v3].pCurrentPosActiveItem = v4;
+				v21 = v19->uControlParam;
+				/*if ( (signed int)v2 < 40 )
+				{
+				pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v19->uControlID;
+				pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v21;
+				*(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
+				++pMessageQueue_50CBD0->uNumMessages;
+				}*/
+				pMessageQueue_50CBD0->AddMessage((UIMessageType)v19->uControlID, v21, v1);
 				return 1;
-			  }
-			  ++v4;
-			  if ( v4 >= v29 )
-			  {
-				v1 = 0;
-			    v2 = pMessageQueue_50CBD0->uNumMessages;
+				}
+			case VK_NEXT:
+				{
+				if ( pWindowList[v3].field_30 != v1 )
+				{
+					pMouse->GetClickPos(&uClickX, &uClickY);
+					v4 = pWindowList[v3].pStartingPosActiveItem;
+					v29 = v4 + pWindowList[v3].pNumPresenceButton;
+					if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
+					{
+						while ( 1 )
+						{
+							v14 = pWindowList[v3].pControlsHead;
+							if ( v4 > 0 )
+							{
+								v15 = v4;
+								do
+								{
+									v14 = v14->pNext;
+									--v15;
+								}
+								while ( v15 );
+							}
+							if ( (signed int)uClickX >= (signed int)v14->uX
+							&& (signed int)uClickX <= (signed int)v14->uZ
+							&& (signed int)uClickY >= (signed int)v14->uY
+							&& (signed int)uClickY <= (signed int)v14->uW )
+							{
+								pWindowList[v3].pCurrentPosActiveItem = v4;
+								return 1;
+							}
+							++v4;
+							if ( v4 >= v29 )
+							{
+								v1 = 0;
+								v2 = pMessageQueue_50CBD0->uNumMessages;
+								break;
+							}
+						}
+					}
+					else
+					{
+						v2 = pMessageQueue_50CBD0->uNumMessages;
+					}
+				}
 				break;
-			  }
-			}
-		  }
-		  else
-		  {
-			  v2 = pMessageQueue_50CBD0->uNumMessages;
-		  }
+				}
+			default:
+				{
+				break;
+				}
+			
 		}
 	}
     --v27;
@@ -2445,7 +2435,13 @@
       v18 = v17 >> 1;
       v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u);
       wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item"
-       goto LABEL_116;
+      pRenderer->ResetClip();
+      if ( !areWeLoadingTexture )
+        {
+        v73->Release();
+        pIcons_LOD->_40F9C5();
+        }
+      return;
     }
     if (!inspect_item->Identified())
     {
@@ -2463,7 +2459,13 @@
       v18 = v17 >> 1;
       v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u);
       wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[232], 3);
-      goto LABEL_116;
+      pRenderer->ResetClip();
+      if ( !areWeLoadingTexture )
+          {
+          v73->Release();
+          pIcons_LOD->_40F9C5();
+          }
+      return;
     }
 
     sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], item_desc->pUnidentifiedName); //"Type: %s"
@@ -2517,29 +2519,26 @@
          break;
     }
 
-    if ( v77 )
-      goto LABEL_65;
+    if ( !v77 )
+	{
     //v23 = item_desc->uEquipType;
+		if ( inspect_item->uEncantmentType )
+		 {
+			sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210],
+				 pItemsTable->pEnchantments[inspect_item->uEncantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special"
+		}
+		else  if ( inspect_item->uSpecEnchantmentType )
+		  {      
+			sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], 
+				pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement, inspect_item->_bonus_strength);
+		  }
     
-
-    if ( inspect_item->uEncantmentType )
-     {
-        sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210],
-             pItemsTable->pEnchantments[inspect_item->uEncantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special"
-    }
-    else  if ( inspect_item->uSpecEnchantmentType )
-      {      
-        sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], 
-            pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement, inspect_item->_bonus_strength);
-      }
-    
-    else if ( inspect_item->uNumCharges )
-        {
-        sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges"
-
-        }
-
-LABEL_65:
+		else if ( inspect_item->uNumCharges )
+			{
+			sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges"
+
+			}
+	}
     wHintWindow.uFrameWidth -= 12;
     v85 = 3;
     wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
@@ -2673,7 +2672,15 @@
                 else
                     {
                     if ( !(BYTE1(v38) & 2) )
-                        goto LABEL_116;
+					{
+						pRenderer->ResetClip();
+						if ( !areWeLoadingTexture )
+							{
+							v73->Release();
+							pIcons_LOD->_40F9C5();
+							}
+						return;
+					}
                     v61 = 0;
                     v56 = 0;
                     v51 = 0;
@@ -2687,7 +2694,6 @@
                 v41 = v39 + 132;
                 }
             wHintWindow.DrawText(v40, v41, v42, v44, v47, v51, v56, v61);
-LABEL_116:
             pRenderer->ResetClip();
             if ( !areWeLoadingTexture )
                 {