diff mm7_1.cpp @ 611:7bae884b7cd0

Слияние
author Ritor1
date Wed, 06 Mar 2013 20:16:06 +0600
parents c615ff03b144 55d6b756e03a
children 5bf285f56fa8
line wrap: on
line diff
--- a/mm7_1.cpp	Wed Mar 06 20:15:47 2013 +0600
+++ b/mm7_1.cpp	Wed Mar 06 20:16:06 2013 +0600
@@ -3192,132 +3192,139 @@
     v74 = 0;
     v69 = 0;
     v66 = pGlobalTXT_LocalizationStrings[630];
-    goto LABEL_123;
+    a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78);
   }
-  a4 = 0;
-  v51 = &v121->pActorBuffs[1];
-  v222 = 0;
-  v120 = &v121->pActorBuffs[1];
-  do
+  else
   {
-    if ( (signed __int64)v51->uExpireTime > 0 )
-    {
-      switch ( (int)v51 )
-      {
-        case 0u:
-          v124 = 60;
-          a4 = pGlobalTXT_LocalizationStrings[591];
-          break;
-        case 1u:
-          v124 = 82;
-          a4 = pGlobalTXT_LocalizationStrings[649];
-          break;
-        case 2u:
-          v124 = 92;
-          a4 = pGlobalTXT_LocalizationStrings[592];
-          break;
-        case 3u:
-          v124 = 63;
-          a4 = pGlobalTXT_LocalizationStrings[4];
-          break;
-        case 4u:
-          v52 = pGlobalTXT_LocalizationStrings[220];
-          goto LABEL_100;
-        case 5u:
-          v52 = pGlobalTXT_LocalizationStrings[162];
-LABEL_100:
-          a4 = v52;
-          v124 = 81;
-          break;
-        case 6u:
-          v53 = pGlobalTXT_LocalizationStrings[593];
-          v124 = 35;
-          goto LABEL_103;
-        case 8u:
-          v53 = pGlobalTXT_LocalizationStrings[608];
-          v124 = 62;
-LABEL_103:
-          a4 = v53;
-          break;
-        case 7u:
-        case 9u:
-          a4 = 0;
-          v124 = 0;
-          goto LABEL_119;
-        case 0xAu:
-          v124 = 47;
-          a4 = pGlobalTXT_LocalizationStrings[221];
-          break;
-        case 0xBu:
-          v124 = 66;
-          a4 = pGlobalTXT_LocalizationStrings[607];
-          break;
-        case 0xCu:
-          v124 = 85;
-          a4 = pGlobalTXT_LocalizationStrings[610];
-          break;
-        case 0xDu:
-          v124 = 86;
-          a4 = pGlobalTXT_LocalizationStrings[609];
-          break;
-        case 0xEu:
-          v124 = 17;
-          a4 = pGlobalTXT_LocalizationStrings[279];
-          break;
-        case 0xFu:
-          v124 = 38;
-          a4 = pGlobalTXT_LocalizationStrings[442];
-          break;
-        case 0x10u:
-          v124 = 46;
-          a4 = pGlobalTXT_LocalizationStrings[443];
-          break;
-        case 0x11u:
-          v124 = 51;
-          a4 = pGlobalTXT_LocalizationStrings[440];
-          break;
-        case 0x12u:
-          v124 = 5;
-          a4 = pGlobalTXT_LocalizationStrings[441];
-          break;
-        case 0x13u:
-          v124 = 95;
-          a4 = pGlobalTXT_LocalizationStrings[229];
-          break;
-        case 0x14u:
-          v124 = 73;
-          a4 = pGlobalTXT_LocalizationStrings[228];
-          break;
-        default:
-          a4 = 0;
-          break;
-      }
-      if ( a4 )
-      {
-        v54 = a4;
-        v55 = GetSpellColor(v124);
-        a1->DrawText((GUIFont *)a2, 28, v50, v55, v54, 0, 0, 0);
-        v50 = v50 + BYTE5(a2->pConditions[0]) - 3;
-        v51 = v120;
-      }
-    }
-LABEL_119:
-    ++v51;
-    v222 = (IDirectDrawSurface *)((char *)v222 + 1);
-    v120 = v51;
-
-    __debugbreak(); // fix condition
-  }
-  //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 );
-  while (true);
-  if ( !a4 )
-  {
-    v78 = 0;
-    v74 = 0;
-    v69 = 0;
-    v66 = pGlobalTXT_LocalizationStrings[153];
-LABEL_123:
-    a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78);
+	  a4 = 0;
+	  v51 = &v121->pActorBuffs[1];
+	  v222 = 0;
+	  v120 = &v121->pActorBuffs[1];
+	  do
+	  {
+		if ( (signed __int64)v51->uExpireTime > 0 )
+		{
+		  switch ( (int)v51 )
+		  {
+			case 0u:
+			  v124 = 60;
+			  a4 = pGlobalTXT_LocalizationStrings[591];
+			  break;
+			case 1u:
+			  v124 = 82;
+			  a4 = pGlobalTXT_LocalizationStrings[649];
+			  break;
+			case 2u:
+			  v124 = 92;
+			  a4 = pGlobalTXT_LocalizationStrings[592];
+			  break;
+			case 3u:
+			  v124 = 63;
+			  a4 = pGlobalTXT_LocalizationStrings[4];
+			  break;
+			case 4u:
+			  v52 = pGlobalTXT_LocalizationStrings[220];
+			  a4 = v52;
+			  v124 = 81;
+			  break;
+			case 5u:
+			  v52 = pGlobalTXT_LocalizationStrings[162];
+			  a4 = v52;
+			  v124 = 81;
+			  break;
+			case 6u:
+			  v53 = pGlobalTXT_LocalizationStrings[593];
+			  v124 = 35;
+			  a4 = v53;
+			  break;
+			case 8u:
+			  v53 = pGlobalTXT_LocalizationStrings[608];
+			  v124 = 62;
+			  a4 = v53;
+			  break;
+			case 7u:
+			case 9u:
+			  a4 = 0;
+			  v124 = 0;
+			  ++v51;
+			  v222 = (IDirectDrawSurface *)((char *)v222 + 1);
+			  v120 = v51;
+			  __debugbreak(); // fix condition
+			  continue;
+			case 0xAu:
+			  v124 = 47;
+			  a4 = pGlobalTXT_LocalizationStrings[221];
+			  break;
+			case 0xBu:
+			  v124 = 66;
+			  a4 = pGlobalTXT_LocalizationStrings[607];
+			  break;
+			case 0xCu:
+			  v124 = 85;
+			  a4 = pGlobalTXT_LocalizationStrings[610];
+			  break;
+			case 0xDu:
+			  v124 = 86;
+			  a4 = pGlobalTXT_LocalizationStrings[609];
+			  break;
+			case 0xEu:
+			  v124 = 17;
+			  a4 = pGlobalTXT_LocalizationStrings[279];
+			  break;
+			case 0xFu:
+			  v124 = 38;
+			  a4 = pGlobalTXT_LocalizationStrings[442];
+			  break;
+			case 0x10u:
+			  v124 = 46;
+			  a4 = pGlobalTXT_LocalizationStrings[443];
+			  break;
+			case 0x11u:
+			  v124 = 51;
+			  a4 = pGlobalTXT_LocalizationStrings[440];
+			  break;
+			case 0x12u:
+			  v124 = 5;
+			  a4 = pGlobalTXT_LocalizationStrings[441];
+			  break;
+			case 0x13u:
+			  v124 = 95;
+			  a4 = pGlobalTXT_LocalizationStrings[229];
+			  break;
+			case 0x14u:
+			  v124 = 73;
+			  a4 = pGlobalTXT_LocalizationStrings[228];
+			  break;
+			default:
+			  a4 = 0;
+			  break;
+		  }
+		  if ( a4 )
+		  {
+			v54 = a4;
+			v55 = GetSpellColor(v124);
+			a1->DrawText((GUIFont *)a2, 28, v50, v55, v54, 0, 0, 0);
+			v50 = v50 + BYTE5(a2->pConditions[0]) - 3;
+			v51 = v120;
+		  }
+		}
+
+		++v51;
+		v222 = (IDirectDrawSurface *)((char *)v222 + 1);
+		v120 = v51;
+
+		__debugbreak(); // fix condition
+	  }
+	  //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 );
+	  while (true);
+	  if ( !a4 )
+	  {
+		v78 = 0;
+		v74 = 0;
+		v69 = 0;
+		v66 = pGlobalTXT_LocalizationStrings[153];
+		a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78);
+	  }
   }
   v56 = pFontSmallnum;
   a4 = (char *)v106.uViewportY;
@@ -3384,42 +3391,47 @@
     v76 = 0;
     v71 = pGlobalTXT_LocalizationStrings[628];
     v68 = "%s\f%05u\t080%s\n";
-    goto LABEL_144;
-  }
-  v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[628];
-  v59 = v121;
-  v114 = v121->pMonsterInfo.uSpell1ID;
-  if ( v114 && v121->pMonsterInfo.uSpell2ID )
-    v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629];
-  if ( v114 )
-  {
-    sprintf(pTmpBuf, "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName);
-    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
-    v58 = LOBYTE(v56->uFontHeight);
-    a4 = &a4[v58 - 3];
-    v59 = v121;
-  }
-  v60 = v59->pMonsterInfo.uSpell2ID;
-  if ( v60 )
-  {
-    sprintf(pTmpBuf, "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName);
-    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
-    v58 = LOBYTE(v56->uFontHeight);
-    a4 = &a4[v58 - 3];
-    v59 = v121;
-  }
-  if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID )
-  {
-    v80 = pGlobalTXT_LocalizationStrings[153];
-    v76 = 0;
-    v71 = pGlobalTXT_LocalizationStrings[628];
-    v68 = "%s\f%05u\t060%s\n";
-LABEL_144:
     sprintf(pTmpBuf, v68, v71, v76, v80);
     a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
     v58 = LOBYTE(v56->uFontHeight);
     a4 = &a4[v58 - 3];
   }
+  else
+  {
+	  v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[628];
+	  v59 = v121;
+	  v114 = v121->pMonsterInfo.uSpell1ID;
+	  if ( v114 && v121->pMonsterInfo.uSpell2ID )
+		v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629];
+	  if ( v114 )
+	  {
+		sprintf(pTmpBuf, "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName);
+		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
+		v58 = LOBYTE(v56->uFontHeight);
+		a4 = &a4[v58 - 3];
+		v59 = v121;
+	  }
+	  v60 = v59->pMonsterInfo.uSpell2ID;
+	  if ( v60 )
+	  {
+		sprintf(pTmpBuf, "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName);
+		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
+		v58 = LOBYTE(v56->uFontHeight);
+		a4 = &a4[v58 - 3];
+		v59 = v121;
+	  }
+	  if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID )
+	  {
+		v80 = pGlobalTXT_LocalizationStrings[153];
+		v76 = 0;
+		v71 = pGlobalTXT_LocalizationStrings[628];
+		v68 = "%s\f%05u\t060%s\n";
+		sprintf(pTmpBuf, v68, v71, v76, v80);
+		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
+		v58 = LOBYTE(v56->uFontHeight);
+		a4 = &a4[v58 - 3];
+	  }
+  }
   a4 = &a4[v58 - 3];
   a1->DrawText(v56, 150, (int)a4, a5, pGlobalTXT_LocalizationStrings[626], 0, 0, 0);
   a4 = &a4[LOBYTE(v56->uFontHeight) - 3];
@@ -4322,9 +4334,131 @@
     return;
   }
   v1 = uNumVisibleWindows;
-  if ( uNumVisibleWindows <= 0 )
+  if ( uNumVisibleWindows > 0 )
   {
-LABEL_38:
+	  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 )
+			{
+			  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 )
+			  {
+	//LABEL_24:
+				pMessageType1 = (UIMessageType)pButton->field_1C;
+				if ( pMessageType1 )
+				{
+				  v12 = pButton->uControlParam;
+				  pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0);
+				  /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
+				  {
+					pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1;
+					pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12;
+					*(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
+	//LABEL_27:
+					++pMessageQueue_50CBD0->uNumMessages;
+				  }*/
+				}
+	//LABEL_28:
+				v13 = pButton->pButtonName;
+	//_set_status_and_ret:
+				sub_41C0B8_set_status_string(v13);
+	//LABEL_131:
+				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 )
+				  {
+					//UNDEF(v8);
+					//if ( v9 | v10 )
+					  //goto LABEL_24;
+					//{
+					  pMessageType1 = (UIMessageType)pButton->field_1C;
+					  if ( pMessageType1 )
+					  {
+						v12 = pButton->uControlParam;
+						pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0);
+						/*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
+						{
+						  pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1;
+						  pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12;
+						  *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
+						  ++pMessageQueue_50CBD0->uNumMessages;
+						}*/
+					  }
+					  v13 = pButton->pButtonName;
+					  sub_41C0B8_set_status_string(v13);
+					  uLastPointedObjectID = 1;
+					  return;
+					//}
+				  }
+				}
+			  }
+			  else                                  // click on skill
+			  {
+				if ( pButton->uButtonType == 3
+				  && (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 )
+				{
+	//LABEL_19:
+				  pPlayer = pPlayers[uActiveCharacter];
+				  v5 = LOBYTE(pPlayer->pActiveSkills[pButton->uControlParam]);
+				  v6 = pPlayer->uSkillPoints;
+				  v7 = (v5 & 0x3F) + 1;
+				  if ( v6 < v7 )
+				  {
+					v41 = v7 - v6;
+					v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here"
+				  }
+				  else
+				  {
+					v41 = v7;
+					v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points"
+				  }
+				  sprintf(Str1, v39, v41);
+				  v13 = Str1;
+				  //goto _set_status_and_ret;
+				  sub_41C0B8_set_status_string(v13);
+				  uLastPointedObjectID = 1;
+				  return;
+				}
+			  }
+			}
+		  }
+		}
+		if ( pWindow->uFrameHeight == 480 )
+		  break;
+		--v1;
+		if ( v1 <= 0 )
+		{
+		  break;
+		}
+	  }
+  }
+  if ( uNumVisibleWindows <= 0 || (uNumVisibleWindows > 0 && pWindow->uFrameHeight != 480 && v1 <= 0))
+  {
     if ( pCurrentScreen == SCREEN_CHEST )
     {
       sub_42038D();
@@ -4537,126 +4671,6 @@
     uLastPointedObjectID = pMouse->uPointingObjectID;
     return;
   }
-  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 )
-        {
-          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 )
-          {
-//LABEL_24:
-            pMessageType1 = (UIMessageType)pButton->field_1C;
-            if ( pMessageType1 )
-            {
-              v12 = pButton->uControlParam;
-              pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0);
-              /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-              {
-                pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1;
-                pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12;
-                *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-//LABEL_27:
-                ++pMessageQueue_50CBD0->uNumMessages;
-              }*/
-            }
-//LABEL_28:
-            v13 = pButton->pButtonName;
-//_set_status_and_ret:
-            sub_41C0B8_set_status_string(v13);
-//LABEL_131:
-            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 )
-              {
-                //UNDEF(v8);
-                //if ( v9 | v10 )
-                  //goto LABEL_24;
-                //{
-                  pMessageType1 = (UIMessageType)pButton->field_1C;
-                  if ( pMessageType1 )
-                  {
-                    v12 = pButton->uControlParam;
-                    pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0);
-                    /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-                    {
-                      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1;
-                      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12;
-                      *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-                      ++pMessageQueue_50CBD0->uNumMessages;
-                    }*/
-                  }
-                  v13 = pButton->pButtonName;
-                  sub_41C0B8_set_status_string(v13);
-                  uLastPointedObjectID = 1;
-                  return;
-                //}
-              }
-            }
-          }
-          else                                  // click on skill
-          {
-            if ( pButton->uButtonType == 3
-              && (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 )
-            {
-//LABEL_19:
-              pPlayer = pPlayers[uActiveCharacter];
-              v5 = LOBYTE(pPlayer->pActiveSkills[pButton->uControlParam]);
-              v6 = pPlayer->uSkillPoints;
-              v7 = (v5 & 0x3F) + 1;
-              if ( v6 < v7 )
-              {
-                v41 = v7 - v6;
-                v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here"
-              }
-              else
-              {
-                v41 = v7;
-                v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points"
-              }
-              sprintf(Str1, v39, v41);
-              v13 = Str1;
-              //goto _set_status_and_ret;
-              sub_41C0B8_set_status_string(v13);
-              uLastPointedObjectID = 1;
-              return;
-            }
-          }
-        }
-      }
-    }
-    if ( pWindow->uFrameHeight == 480 )
-      break;
-    --v1;
-    if ( v1 <= 0 )
-    {
-      goto LABEL_38;
-    }
-  }
 }
 
 
@@ -4878,14 +4892,13 @@
 
     if (!player->CanAct())
     {
-      if ( pPlayers[uActiveCharacter]->CanAct())
-        goto LABEL_9;
       player = pPlayers[uActiveCharacter];
     }
-    player->PlaySound(SPEECH_NoRoom, 0);
+    if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct())
+		player->PlaySound(SPEECH_NoRoom, 0);
   }
 
-LABEL_9:
+//LABEL_9:
   if (pCurrentScreen == SCREEN_GAME)
   {
     viewparams->bRedrawGameUI = true;
@@ -5045,7 +5058,8 @@
           memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem));
           v0->RemoveItemAtInventoryIndex(a4);
           v9 = pParty->pPickedItem.uItemID;
-          goto LABEL_24;
+          pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName);
+          return;
         }
         v13 = v8;
         if ( v8 )
@@ -5066,7 +5080,6 @@
           }
           v9 = this_.uItemID;
           memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem));
-LABEL_24:
           pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName);
           return;
         }
@@ -5152,7 +5165,10 @@
       SpriteObject::OnInteraction(a2.y);
       return;
     }
-    goto LABEL_13;
+    v4 = pParty->pPickedItem.uItemID;
+    if ( !pParty->pPickedItem.uItemID )
+		return;
+    goto LABEL_14;
   }
   if ( (v0 & 7) != OBJECT_Actor)
   {
@@ -5160,7 +5176,12 @@
     {
       v13 = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3];
       if ( (signed int)(((unsigned int)v0 >> 16) - pDecorationList->pDecorations[v13->uDecorationDescID].uRadius) >= 512 )
-        goto LABEL_13;
+	  {
+          v4 = pParty->pPickedItem.uItemID;
+          if ( !pParty->pPickedItem.uItemID )
+            return;
+          goto LABEL_14;
+	  }
       v14 = v13->field_16_event_id;
       if ( !v14 )
       {
@@ -5178,7 +5199,12 @@
     else
     {
       if ( (v0 & 7) != OBJECT_BModel || (unsigned int)v0 >= 0x2000000 )
-        goto LABEL_13;
+	  {
+          v4 = pParty->pPickedItem.uItemID;
+          if ( !pParty->pPickedItem.uItemID )
+            return;
+          goto LABEL_14;
+	  }
       v2 = (signed int)(unsigned __int16)v0 >> 3;
       if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
       {
@@ -5186,61 +5212,61 @@
         if ( !(v3->uAttributes & 0x2000000) )
         {
 LABEL_11:
-          v4 = pParty->pPickedItem.uItemID;
-          if ( pParty->pPickedItem.uItemID )
-          {
+			v4 = pParty->pPickedItem.uItemID;
+			if ( !pParty->pPickedItem.uItemID )
+			{
+				ShowNothingHereStatus();
+				v4 = pParty->pPickedItem.uItemID;
+				if ( !pParty->pPickedItem.uItemID )
+					return;
+			}
 LABEL_14:
-            v5 = pItemsTable->pItems[v4].uSpriteID;
-            v6 = 0;
-            a1.uType = v5;
-            if ( (signed int)pObjectList->uNumObjects <= 0 )
-            {
-LABEL_18:
-              LOWORD(v6) = 0;
-            }
-            else
-            {
-              v7 = (char *)&pObjectList->pObjects->uObjectID;
-              while ( v5 != *(short *)v7 )
-              {
-                ++v6;
-                v7 += 56;
-                if ( v6 >= (signed int)pObjectList->uNumObjects )
-                  goto LABEL_18;
-              }
-            }
-            a1.uObjectDescID = v6;
-            a1.vPosition.y = pParty->vPosition.y;
-            a1.field_58_pid = OBJECT_Player;
-            a1.vPosition.x = pParty->vPosition.x;
-            a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
-            a1.uSoundID = 0;
-            a1.uFacing = 0;
-            a1.uAttributes = 8;
-            a1.uSectorID = pIndoor->GetSector(
-                             pParty->vPosition.x,
-                             pParty->vPosition.y,
-                             pParty->sEyelevel + pParty->vPosition.z);
-            a1.uSpriteFrameID = 0;
-            memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u);
-            v8 = (int *)pMouse->GetCursorPos(&v25);
-            v9 = UnprojectX(*v8);
-            a1.Create(pParty->sRotationY + v9, 184, 200, 0);
-            v10 = pIcons_LOD->LoadTexture(
-                    pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName,
-                    TEXTURE_16BIT_PALETTE);
-            if (v10 != -1)
-              pIcons_LOD->pTextures[v10].Release();
-            pMouse->RemoveHoldingItem();
-            pIcons_LOD->_40F9C5();
-            return;
-          }
-          ShowNothingHereStatus();
-LABEL_13:
-          v4 = pParty->pPickedItem.uItemID;
-          if ( !pParty->pPickedItem.uItemID )
-            return;
-          goto LABEL_14;
+			v5 = pItemsTable->pItems[v4].uSpriteID;
+			v6 = 0;
+			a1.uType = v5;
+			if ( (signed int)pObjectList->uNumObjects <= 0 )
+			{
+				LOWORD(v6) = 0;
+			}
+			else
+			{
+				v7 = (char *)&pObjectList->pObjects->uObjectID;
+				while ( v5 != *(short *)v7 )
+				{
+					++v6;
+					v7 += 56;
+					if ( v6 >= (signed int)pObjectList->uNumObjects )
+					{
+						LOWORD(v6) = 0;
+						break;
+					}
+				}
+			}
+			a1.uObjectDescID = v6;
+			a1.vPosition.y = pParty->vPosition.y;
+			a1.field_58_pid = OBJECT_Player;
+			a1.vPosition.x = pParty->vPosition.x;
+			a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
+			a1.uSoundID = 0;
+			a1.uFacing = 0;
+			a1.uAttributes = 8;
+			a1.uSectorID = pIndoor->GetSector(
+								pParty->vPosition.x,
+								pParty->vPosition.y,
+								pParty->sEyelevel + pParty->vPosition.z);
+			a1.uSpriteFrameID = 0;
+			memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u);
+			v8 = (int *)pMouse->GetCursorPos(&v25);
+			v9 = UnprojectX(*v8);
+			a1.Create(pParty->sRotationY + v9, 184, 200, 0);
+			v10 = pIcons_LOD->LoadTexture(
+					pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName,
+					TEXTURE_16BIT_PALETTE);
+			if (v10 != -1)
+				pIcons_LOD->pTextures[v10].Release();
+			pMouse->RemoveHoldingItem();
+			pIcons_LOD->_40F9C5();
+			return;
         }
         v11 = pIndoor->pFaceExtras[v3->uFaceExtraID].uEventID;
       }
@@ -5265,14 +5291,22 @@
       stru_50C198.LootActor(&pActors[v16]);
       return;
     }
-    goto LABEL_13;
+    v4 = pParty->pPickedItem.uItemID;
+    if ( !pParty->pPickedItem.uItemID )
+		return;
+    goto LABEL_14;
   }
   if ( GetAsyncKeyState(VK_SHIFT) >= 0 )
   {
     if ( !v17->GetActorsRelation(0) && !(BYTE2(v17->uAttributes) & 8) )
     {
       if ( (unsigned int)v0 >= 0x2000000 )
-        goto LABEL_13;
+	  {
+          v4 = pParty->pPickedItem.uItemID;
+          if ( !pParty->pPickedItem.uItemID )
+            return;
+          goto LABEL_14;
+	  }
       if ( !v17->CanAct() )
         return;
       v18 = a2.y;