changeset 267:ac44e716d051

DrawDialogueUI logic restored
author Nomad
date Mon, 18 Feb 2013 10:55:38 +0200
parents 006188b68143
children 0b58962bf229
files mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_data.cpp mm7_data.h
diffstat 5 files changed, 119 insertions(+), 281 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_2.cpp	Mon Feb 18 10:06:38 2013 +0200
+++ b/mm7_2.cpp	Mon Feb 18 10:55:38 2013 +0200
@@ -3267,7 +3267,7 @@
           ++v4;
         }
         while ( (signed int)v4 < (signed int)pParty->pHirelings );
-        party_finds_gold(dword_F8B1B4, 0);
+        party_finds_gold(gold_transaction_amount, 0);
         pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0);
         pParty->field_7B5_in_arena_quest = -1;
       }
@@ -3592,12 +3592,12 @@
     else
     {
       v14 = v27;
-      v13 = dword_F8B1B4;
+      v13 = gold_transaction_amount;
     }
   }
 LABEL_55:
   i = 0;
-  for ( dword_F8B1B4 = v26 * v13; i < v14; ++i )
+  for ( gold_transaction_amount = v26 * v13; i < v14; ++i )
   {
     monster_y = pMonsterArenaPlacements[i].y;
     v21 = rand();
--- a/mm7_3.cpp	Mon Feb 18 10:06:38 2013 +0200
+++ b/mm7_3.cpp	Mon Feb 18 10:55:38 2013 +0200
@@ -15042,12 +15042,12 @@
   //unsigned int v3; // eax@2
   char *v4; // esi@3
   //int v5; // eax@11
-  char *v6; // ecx@13
-  char *v7; // eax@16
-  unsigned int v8; // edi@19
-  char *v9; // ecx@27
+  //char *v6; // ecx@13
+  //char *v7; // eax@16
+  //unsigned int v8; // edi@19
+  //char *v9; // ecx@27
   char *v10; // eax@29
-  int v11; // eax@30
+  //int v11; // eax@30
   int v12; // esi@39
   char *v13; // eax@41
   GUIButton *v14; // eax@43
@@ -15079,7 +15079,7 @@
   GUIWindow v51; // [sp+58h] [bp-BCh]@2
   GUIWindow v52; // [sp+ACh] [bp-68h]@42
   char *Str; // [sp+100h] [bp-14h]@104
-  __int16 v54[2]; // [sp+104h] [bp-10h]@2
+  int v54; // [sp+104h] [bp-10h]@2
   unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82
   GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39
   char *pInString=NULL; // [sp+110h] [bp-4h]@32
@@ -15091,13 +15091,13 @@
   v1 = sub_445C8B(uDialogue_SpeakingActorNPC_ID);
   v51.uFrameWidth -= 10;
   v51.uFrameZ -= 10;
-  *(int *)v54 = v1;
+  v54 = v1;
   GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
   GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
   v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u);
   pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background);
-  pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0));
-  pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0));
+  pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_507B04 != -1 ? &pIcons_LOD->pTextures[uTextureID_507B04] : 0));
+  pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, (Texture *)(uTextureID_50795C != -1 ? &pIcons_LOD->pTextures[uTextureID_50795C] : 0));
   pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pDialogueNPCPortraits[0]);
 
   if (pNPC->uProfession)
@@ -15111,252 +15111,90 @@
   v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3);
   pParty->GetPartyFame();
 
+  pInString = nullptr;
   switch (uDialogueType)
   {
+    case DIALOGUE_13:
+      pInString = BuilDialogueString(pNPCStats->pProfessions[pNPC->uProfession - 1].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0);
+    break;
+
     case DIALOGUE_PROFESSION_DETAILS:
     {
-          if (dialogue_show_profession_details)
-          {
-            v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pBenefits;
-            v7 = BuilDialogueString(v6, uActiveCharacter - 1, 0, 0, 0, 0);
-            pInString = v7;
-            pWindow.uFrameWidth = 460;
-            pWindow.uFrameZ = 452;
-            pOutString = pFontArrus;
-            v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-            if ( 352 - v12 < 8 )
-            {
-              pOutString = pFontCreate;
-              v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-            }
-            if (uTextureID_Leather != -1)
-              pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12);
-            pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-            v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
-            pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
-          }
-          else if (pNPC->Hired())
-          {
-            v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pDismissText;
-            v7 = BuilDialogueString(v6, uActiveCharacter - 1, 0, 0, 0, 0);
-            pInString = v7;
-            pWindow.uFrameWidth = 460;
-            pWindow.uFrameZ = 452;
-            pOutString = pFontArrus;
-            v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-            if ( 352 - v12 < 8 )
-            {
-              pOutString = pFontCreate;
-              v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-            }
-            if (uTextureID_Leather != -1)
-              pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12);
-            pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-            v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
-            pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
-          }
-		  else
-		  {
-            v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pJoinText;
-			v7 = BuilDialogueString(v6, uActiveCharacter - 1, 0, 0, 0, 0);
-			pInString = v7;
-			pWindow.uFrameWidth = 460;
-			pWindow.uFrameZ = 452;
-			pOutString = pFontArrus;
-			v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-			if ( 352 - v12 < 8 )
-			{
-			pOutString = pFontCreate;
-			v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-			}
-            if (uTextureID_Leather != -1)
-              pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12);
-			pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-			v13 = FitTextInAWindow(pInString, pOutString,  &pWindow, 0xDu, 0);
-			pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
-		  }
+      auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1;
+
+      if (dialogue_show_profession_details)
+        pInString = BuilDialogueString(prof->pBenefits, uActiveCharacter - 1, 0, 0, 0, 0);
+      else if (pNPC->Hired())
+        pInString = BuilDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0);
+      else
+        pInString = BuilDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0);
     }
     break;
-  }
-
-  if ( (signed int)uDialogueType > DIALOGUE_ARENA_WELCOME )
-  {
-    if ( uDialogueType == DIALOGUE_ARENA_FIGHT_NOT_OVER_YET )
-    {
-      pWindow.uFrameWidth = 460;
-      pWindow.uFrameZ = 452;
-      pOutString = pFontArrus;
-      v12 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7;//"Get back in there you wimps:"
-      if ( 352 - v12 < 8 )
-      {
-        pOutString = pFontCreate;
-        v12 = pFontCreate->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7;
-      }
-      pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
-        (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
-      pRenderer->DrawTextureIndexed(8, 347 - v12, pTexture_591428);
-      v13 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[577], pFontArrus, &pWindow, 0xDu, 0);
-      pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0);
-    }
-    else if ( uDialogueType == DIALOGUE_ARENA_REWARD )
-    {
-      sprintf(v4, pGlobalTXT_LocalizationStrings[576], dword_F8B1B4);// "Congratulations on your win: here's your stuff: %u gold."
-      pInString = v4;
-      pWindow.uFrameWidth = 460;
-      pWindow.uFrameZ = 452;
-      pOutString = pFontArrus;
-      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-      if ( 352 - v12 < 8 )
-      {
-        pOutString = pFontCreate;
-        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-      }
-      pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
-        (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
-      pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
-      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
-    }
-    else if ( uDialogueType == DIALOGUE_ARENA_ALREADY_WON )
-    {
+
+
+    case DIALOGUE_ARENA_WELCOME:
+      pInString = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death.  Remember, you are only allowed one arena combat per visit.  To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:"
+    break;
+
+    case DIALOGUE_ARENA_FIGHT_NOT_OVER_YET:
+      pInString = pGlobalTXT_LocalizationStrings[577]; //"Get back in there you wimps:"
+    break;
+
+    case DIALOGUE_ARENA_REWARD:
+      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[576], gold_transaction_amount);// "Congratulations on your win: here's your stuff: %u gold."
+      pInString = pTmpBuf;
+    break;
+
+    case DIALOGUE_ARENA_ALREADY_WON:
       pInString = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:"
-      pWindow.uFrameWidth = 460;
-      pWindow.uFrameZ = 452;
-      pOutString = pFontArrus;
-      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-      if ( 352 - v12 < 8 )
-      {
-        pOutString = pFontCreate;
-        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-      }
-      pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
-        (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
-      pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
-      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
-    }
-  }
-  else
-  {
-    if ( uDialogueType == DIALOGUE_ARENA_WELCOME )
-    {
-      v7 = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death.  Remember, you are only allowed one arena combat per visit.  To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:"
-      pInString = v7;
-      pWindow.uFrameWidth = 460;
-      pWindow.uFrameZ = 452;
-      pOutString = pFontArrus;
-      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-      if ( 352 - v12 < 8 )
-      {
-        pOutString = pFontCreate;
-        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-      }
-      pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
-        (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
-      pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
-      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
-    }
-    else if ( uDialogueType == DIALOGUE_13 )
-    {
-      v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pJoinText;
-      v7 = BuilDialogueString(v6, uActiveCharacter - 1, 0, 0, 0, 0);
-      pInString = v7;
-      pWindow.uFrameWidth = 460;
-      pWindow.uFrameZ = 452;
-      pOutString = pFontArrus;
-      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-      if ( 352 - v12 < 8 )
-      {
-        pOutString = pFontCreate;
-        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-      }
-      pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0),
-        (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
-      pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
-      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
-    }
-    else if ( (signed int)uDialogueType > DIALOGUE_18 && !((signed int)uDialogueType > DIALOGUE_24 && uDialogueType != DIALOGUE_PROFESSION_DETAILS || byte_5B0938[0]) )
-    {
-	  if ((signed int)uDialogueType <= DIALOGUE_23)
-	  {
-		  v7 = (char *)ptr_F8B1E8;
-		  pInString = v7;
-		  pWindow.uFrameWidth = 460;
-		  pWindow.uFrameZ = 452;
-		  pOutString = pFontArrus;
-		  v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-		  if ( 352 - v12 < 8 )
-		  {
-			pOutString = pFontCreate;
-			v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-		  }
-		  pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0),
-			(uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
-		  pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-		  v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
-		  pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
-	  }
-    }
-	else
-	{    
-		if ( *(int *)v54 == 1 )
-		{
-			v11 = pNPC->greet;
-			v8 = 0;
-			if ( v11 )
-			{
-				v10 = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * v11);
-				if (  pInString != NULL )
-				{
-					pWindow.uFrameWidth = 460;
-					pWindow.uFrameZ = 452;
-					pOutString = pFontArrus;
-					v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-					if ( 352 - v12 < 8 )
-					{
-						pOutString = pFontCreate;
-						v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-					}
-					pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
-					(uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
-					pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-					v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
-					pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
-				}
-			}
-		}
-		else
-		{
-			if ( *(int *)v54 == 2 )
-			{
-				if (pNPC->Hired())
-					v9 = pNPCStats->pProfessions[pNPC->uProfession].pDismissText;
-				else
-					v9 = pNPCStats->pProfessions[pNPC->uProfession].pJoinText; //"Invalid String Passed"
-				pInString = BuilDialogueString(v9, uActiveCharacter - 1, 0, 0, 0, 0);
-				if (  pInString != NULL )
-				{
-					pWindow.uFrameWidth = 460;
-					pWindow.uFrameZ = 452;
-					pOutString = pFontArrus;
-					v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-					if ( 352 - v12 < 8 )
-					{
-						pOutString = pFontCreate;
-						v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
-					}
-                    if (uTextureID_Leather != -1)
-                      pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12);
-					pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-					v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
-					pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
-				}
-			}
-		}
-	}
-  }
+    break;
+
+    default:
+      if (uDialogueType > DIALOGUE_18 && uDialogueType < DIALOGUE_23 && !byte_5B0938[0])
+      {
+        pInString = (char *)ptr_F8B1E8;
+      }
+      else if (v54 == 1)
+      {
+        if (pNPC->greet)
+        {
+          if ((pNPC->uFlags & 3) == 2)
+            pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting2;
+          else
+            pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting1;
+        }
+      }
+      else if (v54 == 2)
+      {
+        auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1;
+
+        if (pNPC->Hired())
+          pInString = BuilDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0);
+        else
+          pInString = BuilDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0);
+      }
+    break;
+  }
+
+  if (pInString)
+  {
+    pWindow.uFrameWidth = 460;
+    pWindow.uFrameZ = 452;
+    auto font = pFontArrus;
+    v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
+    if ( 352 - v12 < 8 )
+    {
+      font = pFontCreate;
+       v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
+    }
+    if (uTextureID_Leather != -1)
+      pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12);
+    pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
+    v13 = FitTextInAWindow(pInString, font,  &pWindow, 0xDu, 0);
+    pDialogueWindow->DrawText(font, 13, 354 - v12, 0, v13, 0, 0, 0);
+  }
+
+
   memcpy(&v52, pDialogueWindow, sizeof(v52));
   v52.uFrameX = 483;
   v52.uFrameWidth = 148;
@@ -15477,16 +15315,16 @@
       if ( (signed int)uNumActors > 0 )
       {
         v55 = (unsigned short *)&pActors[0].uAIState;
-        *(int *)v54 = uNumActors;
+        v54 = uNumActors;
         do
         {
           v30 = *v55;
           if ( *v55 == Dead || v30 == Removed || v30 == Disabled || (v31 = *((int *)v55 + 159)) != 0 && (v31 & 7) == OBJECT_Player)
             ++pInString;
           v55 += 418;
-          --*(int *)v54;
-        }
-        while ( *(int *)v54 );
+          --v54;
+        }
+        while ( v54 );
       }
       if ( pInString == (char *)uNumActors )
         v24 = pGlobalTXT_LocalizationStrings[658];
@@ -15497,7 +15335,7 @@
   pInString = (char *)GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
   v33 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
   v34 = pDialogueWindow;
-  *(int *)v54 = v33;
+  v54 = v33;
   v35 = pDialogueWindow->pStartingPosActiveItem;
   for ( i = v35 + pDialogueWindow->pNumPresenceButton; v35 < i; i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
   {
@@ -15537,7 +15375,7 @@
         v43->uHeight = v44;
         v42 = v45 + v44 - 1;
         v43->uW = v42;
-        v47 = v54[0];
+        v47 = (short)v54;
         if ( (unsigned __int16 *)pDialogueWindow->pCurrentPosActiveItem != v46 )
           v47 = (unsigned __int16)pInString;
         v52.DrawTitleText(pFontArrus, 0, v45, v47, Str, 3u);
--- a/mm7_4.cpp	Mon Feb 18 10:06:38 2013 +0200
+++ b/mm7_4.cpp	Mon Feb 18 10:55:38 2013 +0200
@@ -9507,7 +9507,7 @@
       {
         if ( dword_F8B1A8 )
         {
-          Party::TakeGold(dword_F8B1B4);
+          Party::TakeGold(gold_transaction_amount);
           if ( uActiveCharacter )
           {
             v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_something_todo_with_awards];
@@ -9542,7 +9542,7 @@
       {
         if ( a1 == 82 && dword_F8B1A8 )
         {
-          Party::TakeGold(dword_F8B1B4);
+          Party::TakeGold(gold_transaction_amount);
           v4 = pParty->pPlayers;
           do
           {
@@ -9721,21 +9721,21 @@
   {
     if ( v2 == 1 )
     {
-      dword_F8B1B4 = 5000;
+      gold_transaction_amount = 5000;
       dword_F8B1B0 = 3;
     }
     else
     {
       if ( v2 == 2 )
       {
-        dword_F8B1B4 = 8000;
+        gold_transaction_amount = 8000;
         dword_F8B1B0 = 4;
       }
     }
   }
   else
   {
-    dword_F8B1B4 = 2000;
+    gold_transaction_amount = 2000;
     dword_F8B1B0 = 2;
   }
   v5 = v1->classType;
@@ -9824,7 +9824,7 @@
           case 16:
           case 17:
           case 18:
-            dword_F8B1B4 = 4000;
+            gold_transaction_amount = 4000;
             goto LABEL_42;
           case 19:
             v19 = 114;
@@ -9839,7 +9839,7 @@
             v20 = v1->GetBaseWillpower();
             goto LABEL_61;
           case 24:
-            dword_F8B1B4 = 2500;
+            gold_transaction_amount = 2500;
             v20 = v1->GetBaseEndurance();
             goto LABEL_61;
           case 36:
@@ -9856,13 +9856,13 @@
           case 32:
           case 34:
           case 35:
-            dword_F8B1B4 = 2500;
+            gold_transaction_amount = 2500;
             goto LABEL_42;
           case 8:
           case 9:
           case 10:
           case 11:
-            dword_F8B1B4 = 3000;
+            gold_transaction_amount = 3000;
             goto LABEL_42;
           case 7:
             goto LABEL_67;
@@ -9918,19 +9918,19 @@
           case 32:
           case 34:
           case 35:
-            dword_F8B1B4 = 6000;
+            gold_transaction_amount = 6000;
             goto LABEL_42;
           case 8:
           case 9:
           case 10:
           case 11:
-            dword_F8B1B4 = 7000;
+            gold_transaction_amount = 7000;
             goto LABEL_42;
           case 7:
             break;
         }
 LABEL_67:
-        dword_F8B1B4 = 0;
+        gold_transaction_amount = 0;
         goto LABEL_41;
       }
     }
@@ -9946,19 +9946,19 @@
       && (dword_F8B1AC_something_todo_with_awards <= 33 || dword_F8B1AC_something_todo_with_awards > 35) )
     {
 LABEL_41:
-      if ( !dword_F8B1B4 )
+      if ( !gold_transaction_amount )
         goto LABEL_79;
       goto LABEL_42;
     }
 LABEL_87:
-    dword_F8B1B4 = 500;
+    gold_transaction_amount = 500;
     goto LABEL_41;
   }
   if ( dword_F8B1AC_something_todo_with_awards >= 23 )
     goto LABEL_87;
   if ( dword_F8B1AC_something_todo_with_awards == 7 )
   {
-    dword_F8B1B4 = 0;
+    gold_transaction_amount = 0;
     goto LABEL_79;
   }
   if ( dword_F8B1AC_something_todo_with_awards <= 7 )
@@ -9969,29 +9969,29 @@
       goto LABEL_41;
     goto LABEL_87;
   }
-  dword_F8B1B4 = 1000;
+  gold_transaction_amount = 1000;
 LABEL_42:
-  if ( dword_F8B1B4 > pParty->uNumGold )
+  if ( gold_transaction_amount > pParty->uNumGold )
     return (char *)pNPCTopics[124].pText;
 LABEL_79:
   dword_F8B1A8 = 1;
   if ( v34 == 2 )
   {
-    v27 = dword_F8B1B4;
+    v27 = gold_transaction_amount;
     v24 = pSkillNames[v17];
     v21 = pGlobalTXT_LocalizationStrings[433];
     goto LABEL_90;
   }
   if ( v34 == 3 )
   {
-    v27 = dword_F8B1B4;
+    v27 = gold_transaction_amount;
     v24 = pSkillNames[v17];
     v21 = pGlobalTXT_LocalizationStrings[432];
     goto LABEL_90;
   }
   if ( v34 == 4 )
   {
-    v27 = dword_F8B1B4;
+    v27 = gold_transaction_amount;
     v24 = pSkillNames[v17];
     v21 = pGlobalTXT_LocalizationStrings[225];
 LABEL_90:
@@ -10016,7 +10016,7 @@
   v3 = a1 + 50;
   v4 = pPlayers[uActiveCharacter];
   dword_F8B1AC_something_todo_with_awards = v3;
-  dword_F8B1B4 = dword_4F08EC[v1];
+  gold_transaction_amount = dword_4F08EC[v1];
   if ( v4->CanAct() )
   {
     if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v2->field_152, dword_F8B1AC_something_todo_with_awards) )
@@ -10025,7 +10025,7 @@
     }
     else
     {
-      if ( dword_F8B1B4 <= pParty->uNumGold )
+      if ( gold_transaction_amount <= pParty->uNumGold )
       {
         dword_F8B1A8 = 1;
         return pNPCTopics[v1 + 110].pText;
--- a/mm7_data.cpp	Mon Feb 18 10:06:38 2013 +0200
+++ b/mm7_data.cpp	Mon Feb 18 10:55:38 2013 +0200
@@ -1999,7 +1999,7 @@
 int dword_F8B1A8; // weak
 int dword_F8B1AC_something_todo_with_awards; // idb
 int dword_F8B1B0; // weak
-int dword_F8B1B4; // weak
+int gold_transaction_amount; // F8B1B4
 char *pShopOptions[4];
 _UNKNOWN unk_F8B1C8; // weak
 int dword_F8B1D8; // weak
--- a/mm7_data.h	Mon Feb 18 10:06:38 2013 +0200
+++ b/mm7_data.h	Mon Feb 18 10:55:38 2013 +0200
@@ -1694,7 +1694,7 @@
 extern int dword_F8B1A8; // weak
 extern int dword_F8B1AC_something_todo_with_awards; // idb
 extern int dword_F8B1B0; // weak
-extern int dword_F8B1B4; // weak
+extern int gold_transaction_amount; // F8B1B4
 extern char *pShopOptions[4];
 extern _UNKNOWN unk_F8B1C8; // weak
 extern int dword_F8B1D8; // weak