diff mm7_2.cpp @ 599:deb559e4fe47

Merge
author Gloval
date Wed, 06 Mar 2013 22:47:21 +0400
parents f8a4a2e0b4c9 a463d7784d33
children 628694cd5744
line wrap: on
line diff
--- a/mm7_2.cpp	Wed Mar 06 22:46:40 2013 +0400
+++ b/mm7_2.cpp	Wed Mar 06 22:47:21 2013 +0400
@@ -3247,7 +3247,8 @@
       v22 = 0;
       v21 = (SoundID)11090;
     }
-    goto LABEL_40;
+    pAudioPlayer->PlaySound(v21, v22, v23, v24, v25, v27, v29, v31);
+    return 0;
   }
   if ( a1 == 10 )
   {
@@ -3828,37 +3829,31 @@
   {
     //v3 = p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C];
     v3 = p2DEvents[window_SpeakInHouse->par1C - 1].uType;
-    if ( v3 < 5 )
-      goto LABEL_12;
-    if ( v3 <= 13 )
-    {
-      v0 = rand() % word_4F0F30[(signed int)v1]
-         //+ 11 * p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]
-         + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType
-         + 345;
-    }
-    else
-    {
-      if ( v3 == 14 )
-      {
-        v4 = rand() % 4;
-      }
-      else
-      {
-        if ( v3 == 15 )
-        {
-          v4 = rand() % 3 + 4;
-        }
-        else
-        {
-          if ( v3 != 16 )
-            goto LABEL_12;
-          v4 = rand() % 2 + 7;
-        }
-      }
-      v0 = rand() % word_4F0F30[(signed int)v1] + 11 * v4 + 400;
-    }
-LABEL_12:
+    if ( v3 >= 5 )
+	{
+		if ( v3 <= 13 )
+		{
+		  v0 = rand() % word_4F0F30[(signed int)v1]
+			 //+ 11 * p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]
+			 + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType
+			 + 345;
+		}
+		else
+		{
+		  if ( v3 == 14 )
+		  {
+			v4 = rand() % 4;
+		  }
+		  else if ( v3 == 15 )
+		  {
+			  v4 = rand() % 3 + 4;
+		  }
+		  else if ( v3 == 16 )
+			v4 = rand() % 2 + 7;
+		  if( v3 <= 16 )
+			v0 = rand() % word_4F0F30[(signed int)v1] + 11 * v4 + 400;
+		}
+	}
     if ( v0 == 487 )
     {
       if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) )
@@ -3958,58 +3953,72 @@
   pRenderer->ClearZBuffer(0, 479);
   //v3 = dword_F8B198;
   if ( dword_F8B19C != 1 )
-    goto LABEL_13;
-  if ( in_current_building_type == BildingType_Training )
-  {
-    if ( uMessageParam == 17 )
-    {
-      v4 = 0;
-      v5 = 0;
-      //v6 = pPlayers[uActiveCharacter];
-      //v7 = pPlayers[uActiveCharacter]->uLevel;
-      if ( pPlayers[uActiveCharacter]->uLevel > 0 )
-      {
-        do
-          v4 += v5++ + 1;
-        while ( v5 < pPlayers[uActiveCharacter]->uLevel );
-      }
-      if ( pPlayers[uActiveCharacter]->uLevel < (unsigned __int16)word_4F0866[(unsigned int)window_SpeakInHouse->ptr_1C]
-        && (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4 )
-        return;
-    }
-    goto LABEL_9;
-  }
-  v8 = window_SpeakInHouse;
-  if ( (in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats)
-    && (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7))
-    || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild )
-  {
-LABEL_9:
-    pDialogueWindow->Release();
-    pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1);
-    pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
-                   (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1);
-    pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1);
-LABEL_10:
-    //v3 = dword_F8B198;
-    v8 = window_SpeakInHouse;
-    goto LABEL_11;
-  }
-  if ( uActiveCharacter != v1 )
-  {
-    if ( !pPlayers[uActiveCharacter]->_4B6FF9() )
-      return;
-    goto LABEL_10;
-  }
-LABEL_11:
-  dword_F8B19C = uMessageParam;
-  if ( in_current_building_type < BildingType_19 )
-  {
-    v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE);
-    //v3 = dword_F8B198;
-    ShopTexture = &pIcons_LOD->pTextures[v9];
-LABEL_13:
-    v8 = window_SpeakInHouse;
+  {
+	v8 = window_SpeakInHouse;
+  }
+  else
+  {
+	  if ( in_current_building_type == BildingType_Training )
+	  {
+		if ( uMessageParam == 17 )
+		{
+		  v4 = 0;
+		  v5 = 0;
+		  //v6 = pPlayers[uActiveCharacter];
+		  //v7 = pPlayers[uActiveCharacter]->uLevel;
+		  if ( pPlayers[uActiveCharacter]->uLevel > 0 )
+		  {
+			do
+			  v4 += v5++ + 1;
+			while ( v5 < pPlayers[uActiveCharacter]->uLevel );
+		  }
+		  if ( pPlayers[uActiveCharacter]->uLevel < (unsigned __int16)word_4F0866[(unsigned int)window_SpeakInHouse->ptr_1C]
+			&& (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4 )
+			return;
+		}
+		pDialogueWindow->Release();
+		pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1);
+		pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
+					   (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1);
+		pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1);
+//	LABEL_10:
+		//v3 = dword_F8B198;
+		v8 = window_SpeakInHouse;
+	  }
+	  else
+	  {
+		  v8 = window_SpeakInHouse;
+		  if ( (in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats)
+			&& (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7))
+			|| in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild )
+		  {
+		//LABEL_9:
+			pDialogueWindow->Release();
+			pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1);
+			pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
+						   (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1);
+			pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1);
+	//	LABEL_10:
+			//v3 = dword_F8B198;
+			v8 = window_SpeakInHouse;
+		  }
+		  else if ( uActiveCharacter != v1 )
+		  {
+			if ( !pPlayers[uActiveCharacter]->_4B6FF9() )
+			  return;
+			v8 = window_SpeakInHouse;
+		  }
+	  }
+	//LABEL_11:
+	  dword_F8B19C = uMessageParam;
+	  if ( in_current_building_type < BildingType_19 )
+	  {
+		v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE);
+		//v3 = dword_F8B198;
+		ShopTexture = &pIcons_LOD->pTextures[v9];
+	//LABEL_13:
+		v8 = window_SpeakInHouse;
+	  }
   }
   if ( in_current_building_type > BildingType_Tavern )
   {
@@ -4263,12 +4272,10 @@
             v1 = 0;
             dword_F8B1A4 = pNPCTopics[352].pText;
           }
-          goto LABEL_196;
-        }
-        if ( uMessageParam == 100 )
+        }
+        else if ( uMessageParam == 100 )
         {
           pKeyActionMap->EnterText(1, 10, v8);
-          goto LABEL_196;
         }
       }
     }
@@ -4527,7 +4534,7 @@
       if ( v0 == -1 )
       {
         _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1));
-LABEL_33:
+//LABEL_33:
         pVideoPlayer->_4BF5B2();
         return 1;
       }
@@ -4544,7 +4551,7 @@
           if ( v0 != 102 && v0 != 103 && v0 != 104 )
           {
             pVideoPlayer->_4BF5B2();
-LABEL_28:
+//LABEL_28:
             dword_F8B19C = 1;
             sub_4B3B42(in_current_building_type);
             return 1;
@@ -4558,7 +4565,9 @@
       }
       pVideoPlayer->_4BF5B2();
       UI_CreateEndConversationButton();
-      goto LABEL_28;
+	  dword_F8B19C = 1;
+	  sub_4B3B42(in_current_building_type);
+	  return 1;
     }
     pDialogueNPCCount = 0;
     pDialogueWindow->Release();
@@ -4583,7 +4592,8 @@
         }
         while ( (signed int)v2 < uNumDialogueNPCPortraits );
       }
-      goto LABEL_33;
+      pVideoPlayer->_4BF5B2();
+      return 1;
     }
   }
   return 0;
@@ -4682,7 +4692,10 @@
   v0 = pPlayers[uActiveCharacter];
   v77 = pPlayers[uActiveCharacter];
   if ( pCurrentScreen == SCREEN_E )
-    goto LABEL_73;
+  {
+    sub_421EA6_OnInventoryLeftClick();
+    return;
+  }
   if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
   {
     v56 = 0;
@@ -4692,7 +4705,8 @@
     v48 = -1;
     v47 = 0;
     v46 = 0;
-    goto LABEL_87;
+    pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
+    return;
   }
   if ( dword_F8B19C > 18 )
   {
@@ -4719,14 +4733,17 @@
               v55 = 4;
             else
               v55 = 2;
-            goto LABEL_84;
+            HousePlaySomeSound((unsigned int)v13, v55);
+            return;
           }
           Party::TakeGold(v44);
           v53 = 0;
           dword_F8B1E4 = 1;
           *pSkill = 1;
           v51 = 78;
-          goto LABEL_80;
+          v27 = v0;
+		  v27->PlaySound((PlayerSpeech)v51, v53);
+		  return;
         }
       }
       return;
@@ -4738,7 +4755,7 @@
       goto LABEL_49;
     }
     pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
-LABEL_73:
+//LABEL_73:
     sub_421EA6_OnInventoryLeftClick();
     return;
   }
@@ -4760,11 +4777,12 @@
     if ( pParty->uNumGold < v23 )
     {
       v24 = 2;
-LABEL_62:
+//LABEL_62:
       HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24);
       v9 = pGlobalTXT_LocalizationStrings[155];
       v54 = 2;
-      goto LABEL_71;
+      ShowStatusBarString(v9, v54);
+      return;
     }
     v25 = v0->AddItem(0xFFFFFFFFu, v20->uItemID);
     if ( v25 )
@@ -4772,13 +4790,23 @@
       v26 = 1;
       v20->SetIdentified();
       memcpy(&v0->pInventoryItems[v25-1], v20, 0x24u);
-      goto LABEL_42;
+      dword_F8B1E4 = v26;
+      Party::TakeGold(v80);
+      viewparams->bRedrawGameUI = v26;
+      _this->Reset();
+      pRenderer->ClearZBuffer(0, 479);
+      v27 = v77;
+      v53 = 0;
+      v51 = SPEECH_75;
+      v27->PlaySound((PlayerSpeech)v51, v53);
+      return;
     }
     v0->PlaySound(SPEECH_NoRoom, 0);
     v54 = 5;
-LABEL_70:
+//LABEL_70:
     v9 = pGlobalTXT_LocalizationStrings[563];   // "Pack is Full!"
-    goto LABEL_71;
+    ShowStatusBarString(v9, v54);
+    return;
   }
   if ( dword_F8B19C == 2 )
   {
@@ -4832,7 +4860,13 @@
       if ( uNumSeconds != 2 )
       {
         if ( uNumSeconds != 1 )
-          goto LABEL_62;
+		{
+		  HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24);
+		  v9 = pGlobalTXT_LocalizationStrings[155];
+		  v54 = 2;
+          ShowStatusBarString(v9, v54);
+          return;
+		}
       }
     }
     v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID);
@@ -4851,27 +4885,36 @@
           {
             *(char *)(v40 + 517) |= 1u;
             sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6);
-            goto LABEL_43;
-          }
-        }
-      }
-LABEL_42:
+		    viewparams->bRedrawGameUI = v26;
+		    _this->Reset();
+		    pRenderer->ClearZBuffer(0, 479);
+		    v27 = v77;
+		    v53 = 0;
+		    v51 = SPEECH_75;
+		    v27->PlaySound((PlayerSpeech)v51, v53);
+		    return;
+          }
+        }
+      }
+//LABEL_42:
       dword_F8B1E4 = v26;
       Party::TakeGold(v80);
-LABEL_43:
+//LABEL_43:
       viewparams->bRedrawGameUI = v26;
       _this->Reset();
       pRenderer->ClearZBuffer(0, 479);
       v27 = v77;
       v53 = 0;
       v51 = SPEECH_75;
-LABEL_81:
+//LABEL_81:
       v27->PlaySound((PlayerSpeech)v51, v53);
       return;
     }
     v0->PlaySound(SPEECH_NoRoom, 0);
     v54 = 2;
-    goto LABEL_70;
+    v9 = pGlobalTXT_LocalizationStrings[563];   // "Pack is Full!"
+    ShowStatusBarString(v9, v54);
+    return;
   }
   if ( dword_F8B19C == 3 )
   {
@@ -4890,8 +4933,10 @@
       pRenderer->ClearZBuffer(0, 479);
       v53 = 0;
       v51 = 77;
-      goto LABEL_80;
-    }
+      v27 = v0;
+      v27->PlaySound((PlayerSpeech)v51, v53);
+      return;
+	}
     v0->PlaySound(SPEECH_79, 0);
     v56 = 0;
     v52 = 0;
@@ -4900,7 +4945,7 @@
     v48 = -1;
     v47 = 0;
     v46 = 0;
-LABEL_87:
+//LABEL_87:
     pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
     return;
   }
@@ -4930,19 +4975,29 @@
                 *(int *)(v12 + 20) |= 1u;
                 v0->PlaySound(SPEECH_73, 0);
                 v9 = pGlobalTXT_LocalizationStrings[569];
-                goto LABEL_25;
+                v54 = 2;
+                ShowStatusBarString(v9, v54);
+                return;
               }
-              goto LABEL_26;
+              v13 = _this;
+              v55 = 2;
+              HousePlaySomeSound((unsigned int)v13, v55);
+              return;
             }
             pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
             v53 = 0;
-            goto LABEL_28;
+            v51 = 79;
+            v27 = v0;
+	        v27->PlaySound((PlayerSpeech)v51, v53);
+		    return;
           }
           v53 = 0;
-LABEL_30:
+//LABEL_30:
           v51 = 76;
-          goto LABEL_80;
-        }
+          v27 = v0;
+	      v27->PlaySound((PlayerSpeech)v51, v53);
+		  return;
+		}
       }
     }
   }
@@ -4983,30 +5038,34 @@
                   *(int *)(v3 + 20) = v8 | 1;
                   v0->PlaySound(SPEECH_74, 0);
                   v9 = pGlobalTXT_LocalizationStrings[570];
-LABEL_25:
+//LABEL_25:
                   v54 = 2;
-LABEL_71:
+//LABEL_71:
                   ShowStatusBarString(v9, v54);
                   return;
                 }
-LABEL_26:
+//LABEL_26:
                 v13 = _this;
                 v55 = 2;
-LABEL_84:
+//LABEL_84:
                 HousePlaySomeSound((unsigned int)v13, v55);
                 return;
               }
               pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
               v53 = 0;
-LABEL_28:
+//LABEL_28:
               v51 = 79;
-LABEL_80:
+//LABEL_80:
               v27 = v0;
-              goto LABEL_81;
+			  v27->PlaySound((PlayerSpeech)v51, v53);
+			return;
             }
             v53 = 0;
-            goto LABEL_30;
-          }
+            v51 = 76;
+            v27 = v0;
+	        v27->PlaySound((PlayerSpeech)v51, v53);
+		    return;          
+		  }
         }
       }
     }
@@ -5130,15 +5189,26 @@
       *v2 = v5;
       if ( !v5 )
       {
-LABEL_23:
+//LABEL_23:
         *v2 = 0;
         break;
       }
       if ( v5 == ',' )
       {
         if ( v3 )
-          goto LABEL_18;
-        *v2 = 0;
+		{
+          if ( v4 )
+          {
+            stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2;
+            ++stru_F8B5E8.field_0;
+          }
+          v4 = 0;
+	    }
+		else
+		{
+          *v2 = 0;
+		  v4 = 1;
+		}
       }
       else
       {
@@ -5161,35 +5231,50 @@
                 ++stru_F8B5E8.field_0;
               }
             }
-            goto LABEL_21;
-          }
-LABEL_18:
-          if ( v4 )
-          {
-            stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2;
-            ++stru_F8B5E8.field_0;
-          }
-          v4 = 0;
-          goto LABEL_21;
-        }
-        if ( v3 )
-          goto LABEL_18;
-        *v2 = 0;
-        if ( v4 )
-        {
-          stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2;
-          ++stru_F8B5E8.field_0;
-        }
-      }
-      v4 = 1;
-LABEL_21:
+          }
+		  else
+		  {
+//LABEL_18:
+			  if ( v4 )
+			  {
+				stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2;
+				++stru_F8B5E8.field_0;
+			  }
+			  v4 = 0;
+		  }
+        }
+		else
+		{
+			if ( v3 )
+			{
+			  if ( v4 )
+			  {
+				stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2;
+				++stru_F8B5E8.field_0;
+			  }
+			  v4 = 0;
+			}
+			else
+			{
+				*v2 = 0;
+				if ( v4 )
+				{
+				  stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2;
+				  ++stru_F8B5E8.field_0;
+				}
+				v4 = 1;
+			}
+		}
+      }
+//LABEL_21:
       if ( stru_F8B5E8.field_0 < 30 )
       {
         ++v2;
         if ( (unsigned int)v2 < (unsigned int)&unk_F8B5E0 )
           continue;
       }
-      goto LABEL_23;
+      *v2 = 0;
+      break;
     }
   }
   result = a2;
@@ -11616,12 +11701,6 @@
   pIcons_LOD->_4114F2();
 }
 
-int __stdcall pWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam)
-	{
-	return DefWindowProcA(hWnd, Msg, wParam, lParam);
-	}
-
-
 //----- (004637EB) --------------------------------------------------------
 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam)
 {
@@ -13168,9 +13247,9 @@
   pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6);
 
   if ( ReadWindowsRegistryInt("Bloodsplats", 1) )
-    pGame->uFlags2 |= 0x20u;
+    pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS;
   else
-    pGame->uFlags2 &= 0xFFFFFFDFu;
+    pGame->uFlags2 &= GAME_FLAGS_2_DRAW_BLOODSPLATS;
 
   uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0);
   dword_6BE384_2dacceloff = ReadWindowsRegistryInt("2dacceloff", 0);
@@ -13404,7 +13483,7 @@
   assert(sizeof(stru176) == 0x20);
   assert(sizeof(SavegameHeader) == 0x64);
   assert(sizeof(SavegameList) == 0x3138);
-  assert(sizeof(StorylineText) == 0x168);
+  assert(sizeof(StorylineText) == 0x160);
   assert(sizeof(FactionTable) == 0x1EF1);
   assert(sizeof(Decal) == 0xC20);
   assert(sizeof(DecalBuilder) == 0x30C038);
@@ -14660,16 +14739,13 @@
     {
       if ( v2 )
       {
-LABEL_7:
         LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
         if ( (signed int)SkillToMastery(v5) < 3 )
         {
-LABEL_8:
           v0->PlaySound(SPEECH_39, 0);
           return;
         }
         v3 = pParty->pPickedItem.uItemID;
-        goto LABEL_16;
       }
     }
     else
@@ -14677,11 +14753,21 @@
       if ( (v4 == 8 || v4 == 1 || v4 == 2)
         && v1
         && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uSkillType == 4 )
-        goto LABEL_7;
-    }
-LABEL_16:
+	  {
+        LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
+        if ( (signed int)SkillToMastery(v5) < 3 )
+        {
+          v0->PlaySound(SPEECH_39, 0);
+          return;
+        }
+	  }
+    }
     if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) )
-      goto LABEL_8;
+    {
+
+        v0->PlaySound(SPEECH_39, 0);
+        return;
+    }
     if ( pParty->pPickedItem.uItemID == 604 )
     {
       sub_467E7F_EquipBody(3u);
@@ -14700,16 +14786,39 @@
       case 9u:
       case 0xBu:
         if ( !v0->HasSkill(v4) )
-          goto LABEL_8;
+        {
+          v0->PlaySound(SPEECH_39, 0);
+          return;
+        }
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) )
-          goto LABEL_95;
+		{
+			v46 = 0;
+			v45 = 0;
+			v44 = 0;
+			v43 = 0;
+			v42 = -1;
+			v41 = 0;
+			v40 = 0;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
+		}
         sub_467E7F_EquipBody(v6);
         if ( pParty->pPickedItem.uItemID == 604 )
           WetsuitOff(uActiveCharacter);
         return;
       case 0xAu:
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
-          goto LABEL_95;
+		{
+			v46 = 0;
+			v45 = 0;
+			v44 = 0;
+			v43 = 0;
+			v42 = -1;
+			v41 = 0;
+			v40 = 0;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
+		}
         v52 = 10;
         v7 = (int)&v0->pEquipment.field_28;
         while ( 1 )
@@ -14718,19 +14827,20 @@
           {
             v8 = v0->FindFreeInventorySlot();
             if ( (v8 & 0x80000000u) == 0 )
+			{
+			  v9 = v52;
+			  pParty->pPickedItem.uBodyAnchor = v52 + 1;
+			  memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8]));
+			  *(&v0->pEquipment.uOffHand + v9) = v8 + 1;
+			  pMouse->RemoveHoldingItem();
               break;
+			}
           }
           ++v52;
           v7 += 4;
           if ( (signed int)v52 > 15 )
-            goto LABEL_33;
-        }
-        v9 = v52;
-        pParty->pPickedItem.uBodyAnchor = v52 + 1;
-        memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8]));
-        *(&v0->pEquipment.uOffHand + v9) = v8 + 1;
-        pMouse->RemoveHoldingItem();
-LABEL_33:
+            break;
+        }
         if ( v52 == 16 )
         {
           v52 = v0->pEquipment.field_3C - 1;
@@ -14747,9 +14857,22 @@
         return;
       case 4u:
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
-          goto LABEL_95;
+		{
+			v46 = 0;
+			v45 = 0;
+			v44 = 0;
+			v43 = 0;
+			v42 = -1;
+			v41 = 0;
+			v40 = 0;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
+		}
         if ( !v0->HasSkill(v4) )
-          goto LABEL_8;
+        {
+          v0->PlaySound(SPEECH_39, 0);
+          return;
+        }
         if ( v54 )
         {
           --v54;
@@ -14777,7 +14900,8 @@
             v17 = v52 + 1;
             memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52]));
             v0->pEquipment.uOffHand = v17;
-            goto LABEL_45;
+            pMouse->RemoveHoldingItem();
+	        return;
           }
           memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
           v15 = (int)((char *)v0 + 36 * (v53 - 1));
@@ -14796,9 +14920,22 @@
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter)
           && pParty->pPickedItem.uItemID != 64
           && pParty->pPickedItem.uItemID != 65 )
-          goto LABEL_95;
+		{
+			v46 = 0;
+			v45 = 0;
+			v44 = 0;
+			v43 = 0;
+			v42 = -1;
+			v41 = 0;
+			v40 = 0;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
+		}
         if ( !v0->HasSkill(v4) )
-          goto LABEL_8;
+        {
+          v0->PlaySound(SPEECH_39, 0);
+          return;
+        }
         v50 = 0;
         if ( v4 == 2 && (unsigned __int16)(v0->pActiveSkills[2] & 0xFFC0)
           || v4 == 1 && (signed int)SkillToMastery(v0->pActiveSkills[1]) >= 3 )
@@ -14834,9 +14971,12 @@
                 if ( !v14 )
                   return;
                 v22 = _this.uItemID;
-LABEL_73:
                 v50 = v22;
-                goto LABEL_74;
+				if ( v50 )
+				  stru_A750F8[uActiveCharacter - 1]._494836(
+					*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
+					uActiveCharacter - 1 + 9);
+				break;
               }
               v23 = v0->FindFreeInventorySlot();
               if ( (v23 & 0x80000000u) != 0 )
@@ -14845,12 +14985,16 @@
               v50 = (unsigned int)&v0->pInventoryItems[v23];
               memcpy(&v0->pInventoryItems[v23], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v23]));
               v0->pEquipment.uOffHand = v23 + 1;
-LABEL_71:
               pMouse->RemoveHoldingItem();
               if ( v52 != 12 )
                 return;
               v22 = *(int *)v50;
-              goto LABEL_73;
+			  v50 = v22;
+			  if ( v50 )
+				stru_A750F8[uActiveCharacter - 1]._494836(
+				*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
+				uActiveCharacter - 1 + 9);
+			  break;
             }
           }
         }
@@ -14863,7 +15007,16 @@
           v50 = (unsigned int)&v0->pInventoryItems[v26];
           memcpy(&v0->pInventoryItems[v26], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v26]));
           v0->pEquipment.uMainHand = v26 + 1;
-          goto LABEL_71;
+              pMouse->RemoveHoldingItem();
+              if ( v52 != 12 )
+                return;
+              v22 = *(int *)v50;
+			  v50 = v22;
+			  if ( v50 )
+				stru_A750F8[uActiveCharacter - 1]._494836(
+				*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
+				uActiveCharacter - 1 + 9);
+			  break;
         }
         --v53;
         memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
@@ -14880,7 +15033,6 @@
           v50 = _this.uItemID;
         if ( v51 )
           v0->pEquipment.uOffHand = 0;
-LABEL_74:
         if ( v50 )
           stru_A750F8[uActiveCharacter - 1]._494836(
             *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
@@ -14888,9 +15040,22 @@
         break;
       case 1u:
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
-          goto LABEL_95;
+		{
+			v46 = 0;
+			v45 = 0;
+			v44 = 0;
+			v43 = 0;
+			v42 = -1;
+			v41 = 0;
+			v40 = 0;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
+		}
         if ( !v0->HasSkill(v4) )
-          goto LABEL_8;
+        {
+          v0->PlaySound(SPEECH_39, 0);
+          return;
+        }
         if ( v53 )
         {
           if ( v54 )
@@ -14902,7 +15067,8 @@
             v42 = -1;
             v41 = 0;
             v40 = 0;
-            goto LABEL_96;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
           }
           --v53;
           memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
@@ -14939,7 +15105,6 @@
               v31 = v52 + 1;
               memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52]));
               v0->pEquipment.uMainHand = v31;
-LABEL_45:
               pMouse->RemoveHoldingItem();
             }
           }
@@ -14976,7 +15141,6 @@
     {
       if ( bUnderwater )
       {
-LABEL_95:
         v46 = 0;
         v45 = 0;
         v44 = 0;
@@ -14984,7 +15148,6 @@
         v42 = -1;
         v41 = 0;
         v40 = 0;
-LABEL_96:
         pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
         return;
       }
@@ -15109,71 +15272,75 @@
   }
   v22 = 0;
   v1 = (int *)((signed int)(viewparams->uScreenZ + viewparams->uScreenX) >> 1);
-  if ( (signed int)viewparams->uScreenY >= (signed int)viewparams->uScreenW )
-    goto LABEL_21;
-  v2 = (char *)v1 - 50;
-  v1 = (int *)((char *)v1 + 50);
-  v3 = 640 * viewparams->uScreenY;
-  v17 = v2;
-  v20 = v1;
-  v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1;
-  do
-  {
-    if ( (signed int)v2 >= (signed int)v20 )
-      goto LABEL_20;
-    v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
-    v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
-    v4 = v22;
-    v5 = (((char *)v20 - v2 - 1) >> 1) + 1;
-    do
-    {
-      v6 = 0;
-      v7 = *v1 & 0xFFFF;
-      v19 = 0;
-      if ( v4 > 0 )
-      {
-        do
-        {
-          if ( dword_7207F0[v6] == v7 )
-            break;
-          ++v6;
-          v19 = v6;
-        }
-        while ( v6 < v22 );
-      }
-      if ( (v7 & 7) == OBJECT_Decoration)
-      {
-        v16 = (unsigned int)v7 >> 3;
-        if ( (signed int)(((unsigned int)*v21 >> 16)
-                        - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)v7 >> 3].uDecorationDescID].uRadius) > 512 )
-          goto LABEL_18;
-      }
-      else
-      {
-        if ( (unsigned int)*v21 > 0x2000000 )
-          goto LABEL_18;
-      }
-      if ( v19 == v22 && v4 < 100 )
-      {
-        ++v22;
-        ++v4;
-        v8 = *v21;
-        dword_7207EC[v4] = v7;
-        dword_72065C[v4] = v8;
-      }
-LABEL_18:
-      v1 = v21 + 2;
-      --v5;
-      v21 += 2;
-    }
-    while ( v5 );
-    v2 = v17;
-LABEL_20:
-    v3 += 1280;
-    --v18;
-  }
-  while ( v18 );
-LABEL_21:
+  if ( (signed int)viewparams->uScreenY < (signed int)viewparams->uScreenW )
+  {
+	  v2 = (char *)v1 - 50;
+	  v1 = (int *)((char *)v1 + 50);
+	  v3 = 640 * viewparams->uScreenY;
+	  v17 = v2;
+	  v20 = v1;
+	  v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1;
+	  do
+	  {
+		if ( (signed int)v2 < (signed int)v20 )
+		{
+			v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
+			v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
+			v4 = v22;
+			v5 = (((char *)v20 - v2 - 1) >> 1) + 1;
+			do
+			{
+			  v6 = 0;
+			  v7 = *v1 & 0xFFFF;
+			  v19 = 0;
+			  if ( v4 > 0 )
+			  {
+				do
+				{
+				  if ( dword_7207F0[v6] == v7 )
+					break;
+				  ++v6;
+				  v19 = v6;
+				}
+				while ( v6 < v22 );
+			  }
+			  if ( (v7 & 7) == OBJECT_Decoration)
+			  {
+				v16 = (unsigned int)v7 >> 3;
+				if ( (signed int)(((unsigned int)*v21 >> 16)
+								- pDecorationList->pDecorations[pLevelDecorations[(unsigned int)v7 >> 3].uDecorationDescID].uRadius) <= 512 )
+				  if ( v19 == v22 && v4 < 100 )
+				  {
+					++v22;
+					++v4;
+					v8 = *v21;
+					dword_7207EC[v4] = v7;
+					dword_72065C[v4] = v8;
+				  }
+			  }
+			  else if ( (unsigned int)*v21 <= 0x2000000 )
+			  {
+				  if ( v19 == v22 && v4 < 100 )
+				  {
+					++v22;
+					++v4;
+					v8 = *v21;
+					dword_7207EC[v4] = v7;
+					dword_72065C[v4] = v8;
+				  }
+			  }
+			  v1 = v21 + 2;
+			  --v5;
+			  v21 += 2;
+			}
+			while ( v5 );
+			v2 = v17;
+		}
+		v3 += 1280;
+		--v18;
+	  }
+	  while ( v18 );
+  }
   if ( v22 > 0 )
   {
     v9 = dword_720660;
@@ -15348,7 +15515,6 @@
           || (v7 = &pOutdoor->pBModels[a1 >> 9].pFaces[(a1 >> 3) & 0x3F], BYTE2(v7->uAttributes) & 0x10)
           || (v6 = v7->sCogTriggeredID) == 0 )
           return 1;
-LABEL_13:
         EventProcessor((signed __int16)v6, v2, 1);
         return 0;
       }
@@ -15362,7 +15528,10 @@
       if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 )
         return 1;
       if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG )
-        goto LABEL_13;
+	  {
+        EventProcessor((signed __int16)v6, v2, 1);
+        return 0;
+	  }
       break;
   }
   return 0;