diff mm7_2.cpp @ 532:a4fe569c0d63

TownHallDialog clean
author zipi
date Sun, 03 Mar 2013 12:22:14 +0000
parents 72a92f0ec766
children 0193f10fecbf
line wrap: on
line diff
--- a/mm7_2.cpp	Sun Mar 03 11:24:48 2013 +0000
+++ b/mm7_2.cpp	Sun Mar 03 12:22:14 2013 +0000
@@ -150,141 +150,144 @@
   v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
   sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
   _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u);
-  if ( dword_F8B19C == 1 )
-  {
-    v11 = 1;
-    pOutString = 0;
-    pShopOptions[0] = pGlobalTXT_LocalizationStrings[604];
-    if ( pParty->uFine )
-    {
-      pShopOptions[1] = pGlobalTXT_LocalizationStrings[603];
-      v11 = 2;
-    }
-    for ( i = 0; i < v11; ++i )
-    {
-      v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0);
-      pOutString = (GUIFont *)((char *)pOutString + v13);
-    }
-    v29 = (100 - (signed int)pOutString) / v11;
-    v14 = pDialogueWindow;
-    v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString;
-    v16 = v15 - HIDWORD(v15);
-    LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem;
-    HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton;
-    v17 = (v16 >> 1) - v29 / 2 + 158;
-    v18 = -pDialogueWindow->pNumPresenceButton < 0;
-    pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
-    if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) )
-    {
-      v31 = 2;
-      v19 = pShopOptions;
-      do
-      {
-        v20 = v14->GetControl((unsigned int)pOutString);
-        v21 = v20;
-        v20->uY = v29 + v17;
-        v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0);
-        v23 = v21->uY;
-        v21->uHeight = v22;
-        v17 = v23 + v22 - 1;
-        v21->uW = v17;
-        v24 = v30;
-        if ( pDialogueWindow->pCurrentPosActiveItem != v31 )
-          v24 = v28;
-        _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u);
-        v14 = pDialogueWindow;
-        ++v31;
-        ++v19;
-        pOutString = (GUIFont *)((char *)pOutString + 1);
-      }
-      while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
-    }
-  }
-  else
-  {
-    if ( dword_F8B19C != 99 )
-    {
-      if ( dword_F8B19C != 100 )
-        return;
-      v0 = window_SpeakInHouse;
-      if ( window_SpeakInHouse->field_40 == 1 )
-      {
-        sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]);
-        _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u);
-        _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
-        v3 = pFontArrus;
-        v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
-        _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3);
-        return;
-      }
-      if ( window_SpeakInHouse->field_40 == 2 )
-      {
-        v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
-        v2 = v1;
-        if ( v1 <= 0 )
-        {
-LABEL_8:
-          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 ( v1 > pParty->uNumGold )
-        {
-          HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
-          v2 = pParty->uNumGold;
-        }
-        if ( v2 > pParty->uFine )
-          v2 = pParty->uFine;
-        Party::TakeGold(v2);
-        pParty->uFine -= v2;
-        if ( pParty->uFine < 0 )
-          pParty->uFine = 0;
-        if ( uActiveCharacter )
-          pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
-        v0 = window_SpeakInHouse;
-      }
-      else
-      {
-        if ( window_SpeakInHouse->field_40 != 3 )
-          return;
-      }
-      v0->field_40 = 0;
-      goto LABEL_8;
-    }
-    v5 = &pMonsterStats->pInfos[word_F8B1A0];
-    v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-    v7 = v5->pName;
-    v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
-    sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6);
-    sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
-    ptr_F8B1E8 = pTmpBuf2;
-    memcpy(&a1, pDialogueWindow, sizeof(a1));
-    w.uFrameWidth = 458;
-    w.uFrameZ = 457;
-    pOutString = pFontArrus;
-    v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7;
-    if ( 352 - v9 < 8 )
-    {
-      pOutString = pFontCreate;
-      v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7;
-    }
-
-    auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
-    pRenderer->_4A6A68(
-      8u,
-      352 - v9,
-      pTex,
-      (pTex ? pTex->uTextureHeight : 26) - v9);
-    pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428);
-    v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0);
-    a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0);
-  }
+  switch(dword_F8B19C)
+  {
+	case 1:
+		{
+		v11 = 1;
+		pOutString = 0;
+		pShopOptions[0] = pGlobalTXT_LocalizationStrings[604];
+		if ( pParty->uFine )
+		{
+			pShopOptions[1] = pGlobalTXT_LocalizationStrings[603];
+			v11 = 2;
+		}
+		for ( i = 0; i < v11; ++i )
+		{
+			v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0);
+			pOutString = (GUIFont *)((char *)pOutString + v13);
+		}
+		v29 = (100 - (signed int)pOutString) / v11;
+		v14 = pDialogueWindow;
+		v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString;
+		v16 = v15 - HIDWORD(v15);
+		LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem;
+		HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton;
+		v17 = (v16 >> 1) - v29 / 2 + 158;
+		v18 = -pDialogueWindow->pNumPresenceButton < 0;
+		pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
+		if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) )
+		{
+			v31 = 2;
+			v19 = pShopOptions;
+			do
+			{
+				v20 = v14->GetControl((unsigned int)pOutString);
+				v21 = v20;
+				v20->uY = v29 + v17;
+				v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0);
+				v23 = v21->uY;
+				v21->uHeight = v22;
+				v17 = v23 + v22 - 1;
+				v21->uW = v17;
+				v24 = v30;
+				if ( pDialogueWindow->pCurrentPosActiveItem != v31 )
+					v24 = v28;
+				_this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u);
+				v14 = pDialogueWindow;
+				++v31;
+				++v19;
+				pOutString = (GUIFont *)((char *)pOutString + 1);
+			}
+			while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
+		}
+		break;
+		}
+	case 99:
+		{
+		v5 = &pMonsterStats->pInfos[word_F8B1A0];
+		v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
+		v7 = v5->pName;
+		v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+		sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6);
+		sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
+		ptr_F8B1E8 = pTmpBuf2;
+		memcpy(&a1, pDialogueWindow, sizeof(a1));
+		w.uFrameWidth = 458;
+		w.uFrameZ = 457;
+		pOutString = pFontArrus;
+		v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7;
+		if ( 352 - v9 < 8 )
+		{
+			pOutString = pFontCreate;
+			v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7;
+		}
+
+		auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
+		pRenderer->_4A6A68(8u, 352 - v9, pTex, (pTex ? pTex->uTextureHeight : 26) - v9);
+		pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428);
+		v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0);
+		a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0);
+		break;
+		}
+	case 100:
+		{
+		v0 = window_SpeakInHouse;
+		if ( window_SpeakInHouse->field_40 == 1 )
+		{
+			sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]);
+			_this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u);
+			_this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
+			v3 = pFontArrus;
+			v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
+			_this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3);
+			return;
+		}
+		if ( window_SpeakInHouse->field_40 == 2 )
+		{
+			v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+			v2 = v1;
+			if ( v1 <= 0 )
+			{
+			//LABEL_8:
+				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 ( v1 > pParty->uNumGold )
+			{
+				HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
+				v2 = pParty->uNumGold;
+			}
+			if ( v2 > pParty->uFine )
+				v2 = pParty->uFine;
+			Party::TakeGold(v2);
+			pParty->uFine -= v2;
+			if ( pParty->uFine < 0 )
+				pParty->uFine = 0;
+			if ( uActiveCharacter )
+				pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
+			v0 = window_SpeakInHouse;
+		}
+		if ( window_SpeakInHouse->field_40 == 3 )
+		{
+			v0->field_40 = 0;
+			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
+		}
+		break;
+		}
+	default:
+		{
+		break;
+		}
+  }
+  return;
 }
 // F8B19C: using guessed type int dword_F8B19C;
 // F8B1A0: using guessed type __int16 word_F8B1A0;