diff mm7_2.cpp @ 611:7bae884b7cd0

Слияние
author Ritor1
date Wed, 06 Mar 2013 20:16:06 +0600
parents 42d5777c2f47 a463d7784d33
children 5bf285f56fa8
line wrap: on
line diff
--- a/mm7_2.cpp	Wed Mar 06 20:15:47 2013 +0600
+++ b/mm7_2.cpp	Wed Mar 06 20:16:06 2013 +0600
@@ -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,8 +11701,6 @@
   pIcons_LOD->_4114F2();
 }
 
-
-
 //----- (004637EB) --------------------------------------------------------
 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam)
 {
@@ -13166,7 +13249,7 @@
   if ( ReadWindowsRegistryInt("Bloodsplats", 1) )
     pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS;
   else
-    pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS;
+    pGame->uFlags2 &= GAME_FLAGS_2_DRAW_BLOODSPLATS;
 
   uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0);
   dword_6BE384_2dacceloff = ReadWindowsRegistryInt("2dacceloff", 0);