changeset 2012:f39f27b08908

WritePointedObjectStatusString(continue)
author Ritor1
date Sun, 10 Nov 2013 23:08:20 +0600
parents 0449821c27e7
children 9dbc142fc8f7
files UI/UiGame.cpp
diffstat 1 files changed, 83 insertions(+), 126 deletions(-) [+]
line wrap: on
line diff
--- a/UI/UiGame.cpp	Sun Nov 10 21:13:36 2013 +0600
+++ b/UI/UiGame.cpp	Sun Nov 10 23:08:20 2013 +0600
@@ -1387,86 +1387,62 @@
     uLastPointedObjectID = pMouse->uPointingObjectID;
     return;
   }
-  v1 = uNumVisibleWindows;
-  if ( uNumVisibleWindows > 0 )
+
+  for ( v1 = uNumVisibleWindows; v1 > 0; --v1 ) // some other fullscreen ui
   {
-	  while ( 1 )                                   // some other fullscreen ui
-	  {
-		pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1];
-		if ( (signed int)pX >= (signed int)pWindow->uFrameX
-		  && (signed int)pX <= (signed int)pWindow->uFrameZ
-		  && (signed int)pY >= (signed int)pWindow->uFrameY
-		  && (signed int)pY <= (signed int)pWindow->uFrameW )
-		{
-		  for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext )
-		  {
-			if ( !pButton )
-			  break;
-			if ( pButton->uButtonType == 1 )//for dialogue window
-			{
-			  if ( (signed int)pX >= (signed int)pButton->uX
-				&& (signed int)pX <= (signed int)pButton->uZ
-				&& (signed int)pY >= (signed int)pButton->uY
-				&& (signed int)pY <= (signed int)pButton->uW )
-			  {
-				pMessageType1 = (UIMessageType)pButton->field_1C;
-				if ( pMessageType1 )
-				{
-				  pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
-				}
-				GameUI_SetFooterString(pButton->pButtonName);
-				uLastPointedObjectID = 1;
-				return;
-			  }
-			}
-			else
-			{
-			  if ( pButton->uButtonType == 2 )
-			  {
-				v45 = pX - pButton->uX;
-				v45 = pY - pButton->uY;
-				if ( (double)(signed int)pButton->uWidth != 0.0 )
-				{
-				  if ( (double)(signed int)pButton->uHeight != 0.0 )
-				  {
-					  pMessageType1 = (UIMessageType)pButton->field_1C;
-					  if ( pMessageType1 )
-					  {
-						pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
-					  }
-					  GameUI_SetFooterString(pButton->pButtonName);
-					  uLastPointedObjectID = 1;
-					  return;
-					//}
-				  }
-				}
-			  }
-			  else                                  // click on skill
-			  {
-              if ( pButton->uButtonType == 3 && pX >= pButton->uX && pX <= pButton->uZ && pY >= pButton->uY && pY <= pButton->uW )
-              {
-                v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1;
-                if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 )
-                  sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here"
-                else
-                  sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points"
-                GameUI_SetFooterString(Str1);
-                uLastPointedObjectID = 1;
-                return;
-				}
-			  }
-			}
-		  }
-		}
-		if ( pWindow->uFrameHeight == 480 )
-		  break;
-		--v1;
-		if ( v1 <= 0 )
-		{
-		  break;
-		}
-	  }
+    pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1];
+    if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ
+      && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW )
+    {
+      for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext )
+      {
+        if ( !pButton )
+          break;
+        switch ( pButton->uButtonType )
+        {
+          case 1://for dialogue window
+            if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ
+              && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW )
+            {
+              pMessageType1 = (UIMessageType)pButton->field_1C;
+              if ( pMessageType1 )
+                pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
+              GameUI_SetFooterString(pButton->pButtonName);
+              uLastPointedObjectID = 1;
+              return;
+            }
+            break;
+          case 2:
+            if ( pX >= pButton->uX && pX <= pButton->uZ
+              && pY >= pButton->uY && pY <= pButton->uW )
+            {
+              pMessageType1 = (UIMessageType)pButton->field_1C;
+              if ( pMessageType1 )
+                pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
+              GameUI_SetFooterString(pButton->pButtonName);
+              uLastPointedObjectID = 1;
+              return;
+            }
+            break;
+           case 3:// click on skill
+             if ( pX >= pButton->uX && pX <= pButton->uZ
+               && pY >= pButton->uY && pY <= pButton->uW )
+             {
+               v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1;
+               if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 )
+                 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here"
+               else
+                 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points"
+               GameUI_SetFooterString(Str1);
+               uLastPointedObjectID = 1;
+               return;
+             }
+             break;
+        }
+      }
+    }
   }
+
   if ( uNumVisibleWindows <= 0 || (uNumVisibleWindows > 0 && pWindow->uFrameHeight != 480 && v1 <= 0))
   {
     if ( pCurrentScreen == SCREEN_CHEST )
@@ -1545,64 +1521,45 @@
       return;
     }
 _click_on_game_ui:
-    if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX
-      && (signed int)pX <= (signed int)pWindowList[0].uFrameZ
-      && (signed int)pY >= (signed int)pWindowList[0].uFrameY
-      && (signed int)pY <= (signed int)pWindowList[0].uFrameW )
+    if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX && (signed int)pX <= (signed int)pWindowList[0].uFrameZ
+      && (signed int)pY >= (signed int)pWindowList[0].uFrameY && (signed int)pY <= (signed int)pWindowList[0].uFrameW )
     {
-      for ( pButton = pWindowList[0].pControlsHead; pButton != (GUIButton *)0; pButton = pButton->pNext )
+      for ( pButton = pWindowList[0].pControlsHead; ; pButton = pButton->pNext )
       {
-        if ( pButton->uButtonType == 1 )
+        if ( !pButton )
+          break;
+        switch ( pButton->uButtonType )
         {
-          if ( (signed int)pX >= (signed int)pButton->uX
-            && (signed int)pX <= (signed int)pButton->uZ
-            && (signed int)pY >= (signed int)pButton->uY
-            && (signed int)pY <= (signed int)pButton->uW )
-          {
-            pMessageType3 = (UIMessageType)pButton->field_1C;
-            if ( pMessageType3 == 0 ) // For books
+          case 1:
+            if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ
+              && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW )
             {
-              GameUI_SetFooterString(pButton->pButtonName);
+              pMessageType3 = (UIMessageType)pButton->field_1C;
+              if ( pMessageType3 == 0 ) // For books
+              {
+                GameUI_SetFooterString(pButton->pButtonName);
+                uLastPointedObjectID = 1;
+                return;
+              }
+              pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0);
               uLastPointedObjectID = 1;
               return;
             }
-
-            pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0);
-            uLastPointedObjectID = 1;
-            return;
-          }
-        }
-        else
-        {
-          if ( pButton->uButtonType == 2 )
-          {
-            v45 = pX - pButton->uX;
-            v45 = pY - pButton->uY;
-
+            break;
+          case 2:
             if (pX >= pButton->uX && pX <= pButton->uZ &&
                 pY >= pButton->uY && pY <= pButton->uW)
-            if ( (double)(signed int)pButton->uWidth != 0.0 )
             {
-              if ( (double)(signed int)pButton->uHeight != 0.0 )
-              {
-                 //UNDEF(v32);
-                //if ( v33 | v34 )
-                //{
-                  pMessageType2 = (UIMessageType)pButton->field_1C;
-                  if ( pMessageType2 != 0 )
-                      pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0);
-
-                  GameUI_SetFooterString(pButton->pButtonName); // for character name
-                  uLastPointedObjectID = 1;
-                  return;
-                //}
-              }
+              pMessageType2 = (UIMessageType)pButton->field_1C;
+              if ( pMessageType2 != 0 )
+                pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0);
+              GameUI_SetFooterString(pButton->pButtonName); // for character name
+              uLastPointedObjectID = 1;
+              return;
             }
-          }
-          else
-          {
-            if ( pButton->uButtonType == 3
-              && pX >= pButton->uX && pX <= pButton->uZ
+            break;
+          case 3:
+            if ( pX >= pButton->uX && pX <= pButton->uZ
               && pY >= pButton->uY && pY <= pButton->uW )
             {
               v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1;
@@ -1614,7 +1571,7 @@
               uLastPointedObjectID = 1;
               return;
             }
-          }
+            break;
         }
       }
     }