changeset 585:3ac7059a3f4f

goto clean some refactoring
author zipi
date Wed, 06 Mar 2013 11:39:35 +0000
parents 6a36b1cd767e
children 3c7fca0e01a0
files mm7_1.cpp
diffstat 1 files changed, 296 insertions(+), 264 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_1.cpp	Wed Mar 06 11:05:44 2013 +0000
+++ b/mm7_1.cpp	Wed Mar 06 11:39:35 2013 +0000
@@ -1318,17 +1318,14 @@
     if ( v5 <= (signed int)(signed __int64)(0.34 * v6) )
     {
       v7 = uTextureID_mhp_red;
-LABEL_9:
       v9 = v7;
-      goto LABEL_10;
     }
-    if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) )
+    else if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) )
     {
       v7 = uTextureID_mhp_yel;
-      goto LABEL_9;
+      v9 = v7;
     }
   }
-LABEL_10:
   v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2;
   pRenderer->Clip(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52);
   pRenderer->DrawTextureIndexed(
@@ -1383,61 +1380,59 @@
   {
     v1 = &pParty->pPlayers[v16];
     v11 = v1;
-    if ( v1->sHealth <= 0 )
-      goto LABEL_24;
-    v11 = &pParty->pPlayers[v16];
-    v2 = (double)v1->sHealth;
-    v3 = v2 / (double)v1->GetMaxHealth();
-    if ( v3 <= 0.5 )
-    {
-      if ( v3 <= 0.25 )
-      {
-        if ( v3 <= 0.0 )
-          goto LABEL_24;
-        if ( v16 == 2 || v16 == 3 )
-          v17 = 2;
-        else
-          v17 = 0;
-        pRenderer->Clip(
-          v17 + pHealthBarPos[v16],
-          (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402,
-          v17 + pHealthBarPos[v16] + v13->uTextureWidth,
-          v13->uTextureHeight + 402);
-        v9 = v13;
-      }
-      else
-      {
-        if ( v16 == 2 || v16 == 3 )
-          v17 = 2;
-        else
-          v17 = 0;
-        pRenderer->Clip(
-          v17 + pHealthBarPos[v16],
-          (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402,
-          v17 + pHealthBarPos[v16] + v14->uTextureWidth,
-          v14->uTextureHeight + 402);
-        v9 = v14;
-      }
-    }
-    else
-    {
-      if ( v3 > 1.0 )
-        v3 = 1.0;
-      v4 = (signed __int64)((1.0 - v3) * v15);
-      if ( v16 == 2 || v16 == 3 )
-        v17 = 2;
-      else
-        v17 = 0;
-      pRenderer->Clip(
-        v17 + pHealthBarPos[v16],
-        v4 + 402,
-        v17 + pHealthBarPos[v16] + v0->uTextureWidth,
-        v0->uTextureHeight + 402);
-      v9 = v0;
-    }
-    pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[v16], 0x192u, v9);
-    pRenderer->ResetClip();
-LABEL_24:
+    if ( v1->sHealth > 0 )
+	{
+		v11 = &pParty->pPlayers[v16];
+		v2 = (double)v1->sHealth;
+		v3 = v2 / (double)v1->GetMaxHealth();
+		if( v3 > 0.5 )
+		{
+		  if ( v3 > 1.0 )
+			v3 = 1.0;
+		  v4 = (signed __int64)((1.0 - v3) * v15);
+		  if ( v16 == 2 || v16 == 3 )
+			v17 = 2;
+		  else
+			v17 = 0;
+		  pRenderer->Clip(
+			v17 + pHealthBarPos[v16],
+			v4 + 402,
+			v17 + pHealthBarPos[v16] + v0->uTextureWidth,
+			v0->uTextureHeight + 402);
+		  v9 = v0;
+		}
+		else if ( v3 > 0.25 )
+		{
+			if ( v16 == 2 || v16 == 3 )
+			  v17 = 2;
+			else
+			  v17 = 0;
+			pRenderer->Clip(
+			  v17 + pHealthBarPos[v16],
+			  (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402,
+			  v17 + pHealthBarPos[v16] + v14->uTextureWidth,
+			  v14->uTextureHeight + 402);
+			v9 = v14;
+		}
+		else if ( v3 > 0.0 )
+		{
+			if ( v16 == 2 || v16 == 3 )
+				v17 = 2;
+			else
+				v17 = 0;
+			pRenderer->Clip(
+				v17 + pHealthBarPos[v16],
+				(unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402,
+				v17 + pHealthBarPos[v16] + v13->uTextureWidth,
+				v13->uTextureHeight + 402);
+			v9 = v13;
+		}
+		if( v3 > 0.0 )
+		{
+		  pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[v16], 0x192u, v9);
+		  pRenderer->ResetClip();
+		}
+	}
     v5 = v11;
     v12 = v11->sMana;
     if ( v12 > 0 )
@@ -1936,214 +1931,251 @@
   while ( 1 )
   {
     v3 = pVisibleWindowsIdxs[v27] - 1;
-    if ( pWindowList[v3].field_44 == v1 )
-      goto LABEL_47;
-    if ( v26 != 34 )
-      break;
-    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 )
-            goto LABEL_66;
-          ++v4;
-          if ( v4 >= v29 )
-          {
-LABEL_45:
-            v1 = 0;
-            goto LABEL_46;
-          }
-        }
-      }
-      goto LABEL_46;
-    }
-LABEL_47:
+    if ( pWindowList[v3].field_44 != v1 )
+	{
+		if ( v26 != 34 )
+		{
+		  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 )
+				{
+				  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;
+			  v10 = pWindowList[v3].pCurrentPosActiveItem;
+			  if ( v10 > (signed int)v1 )
+			  {
+				do
+				{
+				  v9 = v9->pNext;
+				  --v10;
+				}
+				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
+				{
+				  v19 = v19->pNext;
+				  --v20;
+				}
+				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 )
+				{
+				  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;
+			  --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
+				{
+				  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;
+		  }
+		}
+	}
     --v27;
     if ( v27 < 0 )
       return 0;
   }
-  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 )
-      goto LABEL_47;
-    v9 = pWindowList[v3].pControlsHead;
-    v13 = pWindowList[v3].pCurrentPosActiveItem;
-    if ( v13 > (signed int)v1 )
-    {
-      do
-      {
-        v9 = v9->pNext;
-        --v13;
-      }
-      while ( v13 );
-    }
-LABEL_26:
-    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);
-    goto LABEL_47;
-  }
-  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 )
-        {
-          pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1);
-          v2 = pMessageQueue_50CBD0->uNumMessages;
-        }
-      }
-      if ( pWindowList[v3].field_30 != v1 )
-        goto LABEL_47;
-      v9 = pWindowList[v3].pControlsHead;
-      v10 = pWindowList[v3].pCurrentPosActiveItem;
-      if ( v10 > (signed int)v1 )
-      {
-        do
-        {
-          v9 = v9->pNext;
-          --v10;
-        }
-        while ( v10 );
-      }
-      goto LABEL_26;
-    }
-    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
-        {
-          v19 = v19->pNext;
-          --v20;
-        }
-        while ( v20 );
-      }
-      goto LABEL_56;
-    }
-    if ( v26 == 41 )
-    {
-      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 )
-            goto LABEL_45;
-        }
-LABEL_66:
-        pWindowList[v3].pCurrentPosActiveItem = v4;
-        return 1;
-      }
-LABEL_46:
-      v2 = pMessageQueue_50CBD0->uNumMessages;
-      goto LABEL_47;
-    }
-    goto LABEL_47;
-  }
-  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 );
-  }
-LABEL_56:
-  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;
+
 }
 
 //----- (0041D20D) --------------------------------------------------------