changeset 547:4475d81889e6

BankDialog clean
author zipi
date Sun, 03 Mar 2013 19:47:48 +0000
parents 0193f10fecbf
children 0ca16f606be8
files mm7_2.cpp
diffstat 1 files changed, 121 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_2.cpp	Sun Mar 03 18:39:35 2013 +0600
+++ b/mm7_2.cpp	Sun Mar 03 19:47:48 2013 +0000
@@ -319,105 +319,127 @@
   *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
   sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
   _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u);
-  if ( dword_F8B19C != 1 )
-  {
-    if ( dword_F8B19C == 7 )
-    {
-      v0 = window_SpeakInHouse;
-      if ( window_SpeakInHouse->field_40 != 1 )
-      {
-        v1 = window_SpeakInHouse->field_40 - 2;
-        if ( window_SpeakInHouse->field_40 == 2 )
-        {
-          v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
-          v7 = v6;
-          if ( !v6 )
-          {
-LABEL_17:
-            pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
-            /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-            {
-              pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
-              pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
-              *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-              ++pMessageQueue_50CBD0->uNumMessages;
-            }*/
-            return;
-          }
-          if ( v6 > pParty->uNumGold )
-          {
-            HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
-            v7 = pParty->uNumGold;
-          }
-          if ( v7 )
-          {
-            Party::TakeGold(v7);
-            pParty->uNumGoldInBank += v7;
-            if ( uActiveCharacter )
-              pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
-          }
-          v0 = window_SpeakInHouse;
-LABEL_16:
-          v0->field_40 = 0;
-          goto LABEL_17;
-        }
-LABEL_15:
-        if ( v1 != 1 )
-          return;
-        goto LABEL_16;
-      }
-      v11 = pGlobalTXT_LocalizationStrings[112];
-      v10 = pGlobalTXT_LocalizationStrings[60];
-    }
-    else
-    {
-      if ( dword_F8B19C != 8 )
-        return;
-      v0 = window_SpeakInHouse;
-      if ( window_SpeakInHouse->field_40 != 1 )
-      {
-        v1 = window_SpeakInHouse->field_40 - 2;
-        if ( window_SpeakInHouse->field_40 == 2 )
-        {
-          window_SpeakInHouse->field_40 = 0;
-          v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
-          v3 = v2;
-          if ( v2 )
-          {
-            if ( v2 > pParty->uNumGoldInBank )
-            {
-              HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
-              v3 = pParty->uNumGoldInBank;
-            }
-            if ( v3 )
-            {
-              Party::SetGold(pParty->uNumGold + v3);
-              pParty->uNumGoldInBank -= v3;
-            }
-          }
-          goto LABEL_17;
-        }
-        goto LABEL_15;
-      }
-      v11 = pGlobalTXT_LocalizationStrings[112];
-      v10 = pGlobalTXT_LocalizationStrings[244];
-    }
-    sprintf(pTmpBuf, "%s\n%s", v10, v11);
-    _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
-    _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
-    v4 = pFontArrus;
-    v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
-    _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
-    return;
-  }
-  v8 = v14[0];
-  if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
-    v8 = v13[0];
-  _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u);
-  v9 = v14[0];
-  if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
-    v9 = v13[0];
-  _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u);
+  switch(dword_F8B19C)
+  {
+	case 1:
+		{
+		v8 = v14[0];
+		if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
+			v8 = v13[0];
+		_this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u);
+		v9 = v14[0];
+		if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
+			v9 = v13[0];
+		_this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u);
+		break;
+		}
+	case 7:
+		{
+		v0 = window_SpeakInHouse;
+		if ( window_SpeakInHouse->field_40 != 1 )
+		{
+			v1 = window_SpeakInHouse->field_40 - 2;
+			if ( window_SpeakInHouse->field_40 == 2 )
+			{
+				v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+				v7 = v6;
+				if ( !v6 )
+				{
+//LABEL_17:
+					pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
+					/*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
+					{
+						pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
+						pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
+						*(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
+						++pMessageQueue_50CBD0->uNumMessages;
+					}*/
+					return;
+				}
+				if ( v6 > pParty->uNumGold )
+				{
+					HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
+					v7 = pParty->uNumGold;
+				}
+				if ( v7 )
+				{
+					Party::TakeGold(v7);
+					pParty->uNumGoldInBank += v7;
+					if ( uActiveCharacter )
+						pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
+				}
+				v0 = window_SpeakInHouse;
+				v0->field_40 = 0;
+				pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
+				return;
+			}
+			if ( v1 != 1 )
+				return;
+			v0->field_40 = 0;
+			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
+			return;      
+		}
+		v11 = pGlobalTXT_LocalizationStrings[112];
+		v10 = pGlobalTXT_LocalizationStrings[60];
+		sprintf(pTmpBuf, "%s\n%s", v10, v11);
+		_this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
+		_this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
+		v4 = pFontArrus;
+		v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
+		_this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
+		break;
+		}
+
+	case 8:
+		{
+		v0 = window_SpeakInHouse;
+		if ( window_SpeakInHouse->field_40 != 1 )
+		{
+			v1 = window_SpeakInHouse->field_40 - 2;
+			if ( window_SpeakInHouse->field_40 == 2 )
+			{
+				window_SpeakInHouse->field_40 = 0;
+				v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+				v3 = v2;
+				if ( v2 )
+				{
+					if ( v2 > pParty->uNumGoldInBank )
+					{
+						HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
+						v3 = pParty->uNumGoldInBank;
+					}
+					if ( v3 )
+					{
+						Party::SetGold(pParty->uNumGold + v3);
+						pParty->uNumGoldInBank -= v3;
+					}
+				}
+				pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
+				return;
+			}
+			if ( v1 != 1 )
+				return;
+			v0->field_40 = 0;
+			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
+			return;  
+		}
+		v11 = pGlobalTXT_LocalizationStrings[112];
+		v10 = pGlobalTXT_LocalizationStrings[244];
+		sprintf(pTmpBuf, "%s\n%s", v10, v11);
+		_this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
+		_this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
+		v4 = pFontArrus;
+		v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
+		_this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
+		return;
+		break;
+		}
+
+	default:
+		{
+		break;
+		}
+  }
 }
 // F8B19C: using guessed type int dword_F8B19C;