changeset 270:d5c41d5e01e0

Слияние
author Ritor1
date Mon, 18 Feb 2013 16:02:32 +0600
parents b34b53ee874d (current diff) 0b58962bf229 (diff)
children 6e585f21a01e e5afd6848268
files mm7_data.cpp mm7_data.h
diffstat 13 files changed, 280 insertions(+), 434 deletions(-) [+]
line wrap: on
line diff
--- a/Game.cpp	Mon Feb 18 16:02:02 2013 +0600
+++ b/Game.cpp	Mon Feb 18 16:02:32 2013 +0600
@@ -94,14 +94,14 @@
 
     if ( !pRenderer->pRenderD3D )
       pMouse->DrawCursorToTarget();
-    if ( !sub_4226C2() || viewparams->field_48 == 1 )
+    if ( !PauseGameDrawing() || viewparams->field_48 == 1 )
     {
       if ( pRenderer->pRenderD3D )
       {
         float v2 = (double)(((signed int)pMiscTimer->uTotalGameTimeElapsed >> 2) & 0x1F) * 0.032258064 * 6.0;
         //v3 = v2 + 6.7553994e15;
         //pRenderer->field_1036A8_bitmapid = LODWORD(v3);
-        pRenderer->field_1036A8_bitmapid = floorf(v2 + 0.5f);
+        pRenderer->hd_water_current_frame = floorf(v2 + 0.5f);
       }
 
       if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
@@ -142,7 +142,7 @@
     GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, pParty->uFlags & 2);
     if (v4)
     {
-      if ( !sub_4226C2() && pRenderer->pRenderD3D) // clear game viewport with transparent color
+      if ( !PauseGameDrawing() && pRenderer->pRenderD3D) // clear game viewport with transparent color
         pRenderer->FillRectFast(pViewport->uViewportX, pViewport->uViewportY, pViewport->uViewportZ - pViewport->uViewportX,
                                 pViewport->uViewportW - pViewport->uViewportY + 1,
                                 pRenderer->uTargetGMask | pRenderer->uTargetBMask);
--- a/Indoor.cpp	Mon Feb 18 16:02:02 2013 +0600
+++ b/Indoor.cpp	Mon Feb 18 16:02:32 2013 +0600
@@ -559,10 +559,10 @@
                     pFace->uSectorID);
 
         if (pFace->Animated() &&
-            pFace->uBitmapID == pRenderer->field_1036AC_bitmapid )
+            pFace->uBitmapID == pRenderer->hd_water_tile_id )
         {
           __debugbreak();
-          v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid];
+          v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
           goto LABEL_42;
         }
 
--- a/LOD.cpp	Mon Feb 18 16:02:02 2013 +0600
+++ b/LOD.cpp	Mon Feb 18 16:02:32 2013 +0600
@@ -2869,15 +2869,15 @@
       ptr_011BB4 = new char[1000];
       memset(ptr_011BB4, 0, 1000);
     }
-    if (strcmp(pContainer, "wtrdr"))//*v4 != 'w' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'd' || v4[4] != 'r' )
+    if (strnicmp(pContainer, "wtrdr", 5))//*v4 != 'w' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'd' || v4[4] != 'r' )
     {
-      if (strcmp(pContainer, "WtrTyl"))//if ( *v4 != 'W' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'T' || v4[4] != 'y' || v4[5] != 'l' )
+      if (strnicmp(pContainer, "WtrTyl", 6))//if ( *v4 != 'W' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'T' || v4[4] != 'y' || v4[5] != 'l' )
       {
         v14 = uNumLoadedFiles;
       }
       else
       {
-        pRenderer->field_1036AC_bitmapid = uNumLoadedFiles;
+        pRenderer->hd_water_tile_id = uNumLoadedFiles;
         v14 = uNumLoadedFiles;
       }
       v13 = pRenderer->LoadTexture(
--- a/Outdoor.cpp	Mon Feb 18 16:02:02 2013 +0600
+++ b/Outdoor.cpp	Mon Feb 18 16:02:32 2013 +0600
@@ -36,7 +36,7 @@
 
 
 stru149 stru_8019C8;
-stru148 array_77EC08[2000];
+stru148 array_77EC08[2000 + 18000];
 Surf stru_80C980;
 Edge defaultEdge; // weak
 Edge stru_80C9A4;
--- a/Outdoor_stuff.h	Mon Feb 18 16:02:02 2013 +0600
+++ b/Outdoor_stuff.h	Mon Feb 18 16:02:32 2013 +0600
@@ -7,6 +7,11 @@
 #pragma pack(push, 1)
 struct stru148
 {
+  inline stru148()
+  {
+    uNumVertices = 0;
+  }
+
   int _479295();
   void _4811A3();
   void _48276F_sr();
@@ -94,7 +99,7 @@
   float field_14;
 };
 #pragma pack(pop)
-extern stru148 array_77EC08[2000];
+extern stru148 array_77EC08[];
 
 
 
--- a/Render.cpp	Mon Feb 18 16:02:02 2013 +0600
+++ b/Render.cpp	Mon Feb 18 16:02:32 2013 +0600
@@ -1834,21 +1834,23 @@
       v8->field_58 = 0;
       ++pOutdoorCamera->numStru148s;
       ++pOutdoorCamera->field_44;
+      assert(pOutdoorCamera->numStru148s < 20000);
+
       v8->uBModelID = 0;
       v8->uBModelFaceID = 0;
       v31 = (8 * (0 | (0 << 6)));
       v8->field_50 = v31 | 6;
-      for (unsigned int k = 0; k < 4; ++k)
+      for (unsigned int k = 0; k < v8->uNumVertices; ++k)
       {
         memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft));
         array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097);
       }
 
       bool transparent = false;
-            if ( v8->flags & 2 && v8->uTileBitmapID == pRenderer->field_1036AC_bitmapid )
+            if ( v8->flags & 2 && v8->uTileBitmapID == pRenderer->hd_water_tile_id)
             {
               //v80 = false;
-              v6 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid];
+              v6 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
             }
             else
             {
@@ -1862,7 +1864,7 @@
       if (!strnicmp(pBitmaps_LOD->pTextures[v8->uTileBitmapID].pName, "wtrdr", 5))  // all shore tile filenames are wtrdrXXX
       {
         pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE);  // no Z writing: the shore tile will be draw in the same place, so taking care about z-fighting
-        pRenderer->DrawTerrainPolygon(v8->uNumVertices, v8, pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]], false, true);
+        pRenderer->DrawTerrainPolygon(v8->uNumVertices, v8, pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true);
         pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE);
         
       }
@@ -2174,10 +2176,10 @@
           //v37 = *(int *)&v16->flags;
           if ( ~v16->flags & 1 )
           {
-            if ( v16->flags & 2 && v16->uTileBitmapID == pRenderer->field_1036AC_bitmapid )
+            if ( v16->flags & 2 && v16->uTileBitmapID == pRenderer->hd_water_tile_id )
             {
               v80 = false;
-              v39 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid];
+              v39 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
             }
             else
             {
@@ -2324,10 +2326,10 @@
       }
       else
       {
-        if ( v57 & 2 && v40->uTileBitmapID == pRenderer->field_1036AC_bitmapid )
+        if ( v57 & 2 && v40->uTileBitmapID == pRenderer->hd_water_tile_id )
         {
           v81 = 0;
-          v58 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid];
+          v58 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
         }
         else
         {
@@ -2439,10 +2441,10 @@
           v74 = v71->flags;
           if ( !(BYTE1(v74) & 1) )
           {
-            if ( v74 & 2 && v71->uTileBitmapID == pRenderer->field_1036AC_bitmapid )
+            if ( v74 & 2 && v71->uTileBitmapID == pRenderer->hd_water_tile_id )
             {
               v80 = false;
-              v75 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid];
+              v75 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
             }
             else
             {
@@ -4694,6 +4696,9 @@
   v1->_gpu_memory_used = 0;
   uNumBillboardsToDraw = 0;
   bFogEnabled = false;
+
+  hd_water_tile_id = -1;
+  hd_water_current_frame = 0;
 }
 
 bool Render::Initialize(bool bWindowed, uint uDefaultDevice,
--- a/Render.h	Mon Feb 18 16:02:02 2013 +0600
+++ b/Render.h	Mon Feb 18 16:02:32 2013 +0600
@@ -441,8 +441,8 @@
   int field_103668;
   unsigned int pHDWaterBitmapIDs[7];
   char field_103688[32];
-  int field_1036A8_bitmapid;
-  int field_1036AC_bitmapid;
+  int hd_water_current_frame;
+  int hd_water_tile_id;
   IDirectDrawSurface4 *pSurface;
   IDirect3DTexture2 *pTexture;
   int field_1036B8;
--- a/mm7_1.cpp	Mon Feb 18 16:02:02 2013 +0600
+++ b/mm7_1.cpp	Mon Feb 18 16:02:32 2013 +0600
@@ -6198,18 +6198,18 @@
 }
 
 //----- (004226C2) --------------------------------------------------------
-bool __cdecl sub_4226C2()
+bool PauseGameDrawing()
 {
-  if ( pCurrentScreen
+  if ( pCurrentScreen != SCREEN_GAME
     && pCurrentScreen != SCREEN_NPC_DIALOGUE
     && pCurrentScreen != SCREEN_CHANGE_LOCATION )
   {
     if ( pCurrentScreen == SCREEN_INPUT_BLV )
       return pVideoPlayer->pSmackerMovie != 0;
     if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG )
-      return 1;
-  }
-  return 0;
+      return true;
+  }
+  return false;
 }
 // 4E28F8: using guessed type int pCurrentScreen;
 
--- a/mm7_2.cpp	Mon Feb 18 16:02:02 2013 +0600
+++ b/mm7_2.cpp	Mon Feb 18 16:02:32 2013 +0600
@@ -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 16:02:02 2013 +0600
+++ b/mm7_3.cpp	Mon Feb 18 16:02:32 2013 +0600
@@ -5654,7 +5654,7 @@
         v7->field_58 = 0;
       if ( v7->field_58 > 31 )
         v7->field_58 = 31;
-      if ( pOutdoorCamera->numStru148s >= 1999 )
+      if ( pOutdoorCamera->numStru148s >= 1999 + 5000)
         return result;
       ++pOutdoorCamera->numStru148s;
       ++pOutdoorCamera->field_44;
@@ -5754,7 +5754,7 @@
             if ( BYTE1(v33) & 0x3C )
               v34 = pRenderer->pHDWaterBitmapIDs[0];
             else
-              v34 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid];
+              v34 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
             v40 = (int)pBitmaps_LOD->pHardwareTextures[v34];
           }
           else
@@ -8393,7 +8393,7 @@
 
   ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0));
   pRenderer->DrawTerrainPolygon(uNumVertices, this,
-    pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]],
+    pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_tile_id]],
     0, 0);
 
   ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1));
@@ -15015,7 +15015,7 @@
 
 
 //----- (00445308) --------------------------------------------------------
-const char *__fastcall sub_445308(int a1)
+const char *GetProfessionActionText(int a1)
 {
   if ( a1 == 10
     || a1 == 11
@@ -15028,7 +15028,7 @@
     || a1 == 42
     || a1 == 43
     || a1 == 52 )
-    return (const char *)*(&pNPCStats->field_13A60 + 5 * a1);
+    return pNPCStats->pProfessions[a1 - 1].pActionText;
   else
     return pNPCTopics[407].pTopic;
 }
@@ -15042,20 +15042,20 @@
   //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
-  GUIButton *v15; // edi@43
+  //GUIButton *v15; // edi@43
   signed int v16; // eax@44
-  unsigned int v23; // eax@53
-  const char *v24; // eax@59
-  unsigned __int16 v30; // cx@83
+  //unsigned int v23; // eax@53
+  //const char *v24; // eax@59
+  //unsigned __int16 v30; // cx@83
   int v31; // ecx@86
   int v32; // ebx@93
   unsigned int v33; // eax@93
@@ -15079,8 +15079,8 @@
   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
-  unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82
+  //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,393 +15111,229 @@
   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 (v1 == 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 (v1 == 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;
   v52.uFrameZ = 334;
-  for ( pOutString = (GUIFont *)v52.pStartingPosActiveItem;
-        (signed int)pOutString < v52.pStartingPosActiveItem + v52.pNumPresenceButton;
-        pOutString = (GUIFont *)((char *)pOutString + 1) )
-  {
-    v14 = v52.GetControl((unsigned int)pOutString);
-    v15 = v14;
+  for (int i = v52.pStartingPosActiveItem;
+       i < v52.pStartingPosActiveItem + v52.pNumPresenceButton; ++i)
+  {
+    v14 = v52.GetControl(i);
+    //v15 = v14;
     if ( !v14 )
       break;
     v16 = v14->uControlParam;
 
     if ( v16 > 88 )
-    {
-        v24 = "";
-    }
-	else if ( v16 == 88 )
-		v24 = pGlobalTXT_LocalizationStrings[581]; // Lord
-    else if ( v16 == 87 )
-	    v24 = pGlobalTXT_LocalizationStrings[580]; // Knight
-    else if ( v16 == 86 )
-	    v24 = pGlobalTXT_LocalizationStrings[579]; // Squire
-    else if ( v16 == 85 )
-		v24 = pGlobalTXT_LocalizationStrings[578]; // Page
-    else if ( v16 == 77 )
-        v24 = pGlobalTXT_LocalizationStrings[407]; // Details
-    else if ( v16 == 76 )
-    {
-		if (pNPC->Hired())
-		{
-			sprintf(pTmpBuf, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s
-			v24 = pTmpBuf;
-		}
-		else
-			v24 = pGlobalTXT_LocalizationStrings[406]; // Hire
-    }
-	else if ( v16 == 24 )
-    {
-		v23 = pNPC->evtf;
-		v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
-		if ( !v24 )
-		{
-			v24 = "";
-			v15->uControlParam = 0;
-		}
-    }
-	else if ( v16 == 9 )
-		v24 = (const char *)sub_445308(pNPC->uProfession);
-	else if ( v16 == 19 )
+      v14->pButtonName[0] = 0;
+	else if (v16 == 88)
+      strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[581]); // Lord
+    else if (v16 == 87)
+      strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[580]); // Knight
+    else if (v16 == 86)
+      strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[579]); // Squire
+    else if (v16 == 85)
+      strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[578]); // Page
+    else if (v16 == 77)
+      strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[407]); // Details
+    else if (v16 == 76)
+    {
+      if (pNPC->Hired())
+        sprintf(v14->pButtonName, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s
+      else
+        strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[406]); // Hire
+    }
+	else if (v16 == 24)
+    {
+      __debugbreak(); // learn conditions of this event
+      auto topic = pNPCTopics[pNPC->evtf - 1].pTopic;//(&dword_721660)[8 * v23];
+      if (!topic)
+      {
+        v14->pButtonName[0] = 0;
+        v14->uControlParam = 0;
+      }
+      else
+        strcpy(v14->pButtonName, topic);
+    }
+	else if (v16 == 9)
+      strcpy(v14->pButtonName, GetProfessionActionText(pNPC->uProfession));
+	else if (v16 == 19)
 	{
-		v23 = pNPC->bDrawSomeAnim;
-		v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
-		if ( !v24 )
-		{
-			v24 = "";
-			v15->uControlParam = 0;
-		}
+      __debugbreak(); // learn conditions of this event
+      auto topic = pNPCTopics[pNPC->bDrawSomeAnim - 1].pTopic;//(&dword_721660)[8 * v23];
+      if (!topic)
+      {
+        v14->pButtonName[0] = 0;
+        v14->uControlParam = 0;
+      }
+      else strcpy(v14->pButtonName, topic);
 	}
-	else if ( v16 == 20 )
+	else if (v16 == 20)
 	{
-		v23 = pNPC->_anim_current_time;
-		v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
-		if ( !v24 )
-		{
-			v24 = "";
-			v15->uControlParam = 0;
-		}
+      __debugbreak(); // learn conditions of this event
+      auto topic = pNPCTopics[pNPC->_anim_current_time - 1].pTopic;//(&dword_721660)[8 * v23];
+      if (!topic)
+      {
+        v14->pButtonName[0] = 0;
+        v14->uControlParam = 0;
+      }
+      else strcpy(v14->pButtonName, topic);
 	}
-	else if ( v16 == 21 )
+	else if (v16 == 21)
 	{
-		v23 = pNPC->_anim_end_time;
-		v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
-		if ( !v24 )
-		{
-			v24 = "";
-			v15->uControlParam = 0;
-		}
+      __debugbreak(); // learn conditions of this event
+      auto topic = pNPCTopics[pNPC->_anim_end_time - 1].pTopic;//(&dword_721660)[8 * v23];
+      if (!topic)
+      {
+        v14->pButtonName[0] = 0;
+        v14->uControlParam = 0;
+      }
+      else strcpy(v14->pButtonName, topic);
 	}
-	else if ( v16 == 22 )
+	else if (v16 == 22)
 	{
-		v23 = pNPC->evtd;
-		v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
-		if ( !v24 )
-		{
-			v24 = "";
-			v15->uControlParam = 0;
-		}
+      __debugbreak(); // learn conditions of this event
+      auto topic = pNPCTopics[pNPC->evtd - 1].pTopic;//(&dword_721660)[8 * v23];
+      if (!topic)
+      {
+        v14->pButtonName[0] = 0;
+        v14->uControlParam = 0;
+      }
+      else strcpy(v14->pButtonName, topic);
 	}
-	else if ( v16 == 23 )
+	else if (v16 == 23)
 	{
-		v23 = pNPC->evte;
-		v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
-		if ( !v24 )
-		{
-			v24 = "";
-			v15->uControlParam = 0;
-		}
+      __debugbreak(); // learn conditions of this event
+      auto topic = pNPCTopics[pNPC->evte - 1].pTopic;//(&dword_721660)[8 * v23];
+      if (!topic)
+      {
+        v14->pButtonName[0] = 0;
+        v14->uControlParam = 0;
+      }
+      else strcpy(v14->pButtonName, topic);
 	}
-	else if ( v16 == 13 )
+	else if (v16 == 13)
 	{
-		if (pNPC->Hired())
-		{
-			sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s
-			v24 = pTmpBuf;
-		}
-		else
-			v24 = pGlobalTXT_LocalizationStrings[122]; // Join
+      if (pNPC->Hired())
+        sprintf(v14->pButtonName, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s
+      else
+        strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[122]); // Join
 	}
 	else
-		v24 = "";
+      v14->pButtonName[0] = 0;
 	
 
-    if ( pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1 )
-    {
+    if (pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1)
+    {
+      int num_dead_actors = 0;
       pInString = 0;
-      if ( (signed int)uNumActors > 0 )
-      {
-        v55 = (unsigned short *)&pActors[0].uAIState;
-        *(int *)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 );
-      }
-      if ( pInString == (char *)uNumActors )
-        v24 = pGlobalTXT_LocalizationStrings[658];
-    }
-    strcpy(v15->pButtonName, v24);
-  }
+      for (uint i = 0; i < uNumActors; ++i)
+      {
+        if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed ||
+            pActors[i].uAIState  == Disabled)
+          ++num_dead_actors;
+        else
+        {
+          int sumonner_type = pActors[i].uSummonerID & 7;;
+          if (sumonner_type == OBJECT_Player)
+            ++num_dead_actors;
+        }
+      }
+      if (num_dead_actors == uNumActors)
+        strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[658]); // Collect Prize
+    }
+  }
+
+
   v32 = 0;
-  pInString = (char *)GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
+  //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 )
   {
@@ -15518,7 +15354,7 @@
     pOutString = (GUIFont *)((174 - v32) / v39);
     if ( (174 - v32) / v39 > 32 )
       pOutString = (GUIFont *)32;
-    v55 = (unsigned __int16 *)1;
+    int v55 = 1;
     v40 = 174 - (int)pOutString * v39 - v32;
     v41 = v34->pStartingPosActiveItem;
     v42 = v40 / 2 - (signed int)pOutString / 2 + 138;
@@ -15533,22 +15369,22 @@
         Str = v43->pButtonName;
         v44 = pFontArrus->CalcTextHeight(v43->pButtonName, &v52, 0, 0);
         v45 = v43->uY;
-        v46 = v55;
+        v46 = (unsigned short *)v55;
         v43->uHeight = v44;
         v42 = v45 + v44 - 1;
         v43->uW = v42;
-        v47 = v54[0];
+        v47 = v33;
         if ( (unsigned __int16 *)pDialogueWindow->pCurrentPosActiveItem != v46 )
-          v47 = (unsigned __int16)pInString;
+          v47 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
         v52.DrawTitleText(pFontArrus, 0, v45, v47, Str, 3u);
         v34 = pDialogueWindow;
-        v55 = (unsigned __int16 *)((char *)v55 + 1);
+        ++v55;
         ++v41;
       }
       while ( (signed int)v41 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
     }
   }
-  pRenderer->DrawTextureIndexed(471, 445, (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0));
+  pRenderer->DrawTextureIndexed(471, 445, (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0));
 }
 
 //----- (004459F9) --------------------------------------------------------
--- a/mm7_4.cpp	Mon Feb 18 16:02:02 2013 +0600
+++ b/mm7_4.cpp	Mon Feb 18 16:02:32 2013 +0600
@@ -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 16:02:02 2013 +0600
+++ b/mm7_data.cpp	Mon Feb 18 16:02:32 2013 +0600
@@ -2045,7 +2045,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 16:02:02 2013 +0600
+++ b/mm7_data.h	Mon Feb 18 16:02:32 2013 +0600
@@ -1648,7 +1648,7 @@
 extern int dword_80AA1C; // weak
 extern int dword_80AA20; // weak
 extern unsigned int uNumElementsIn80AA28;
-extern struct stru148 *ptr_80AA28[2000];
+extern struct stru148 *ptr_80AA28[];
 extern struct Edge *pNewEdges;
 extern struct Surf *pSurfs;
 extern struct Edge *pEdges;
@@ -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
@@ -1912,7 +1912,7 @@
 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb
 void __cdecl sub_421EA6_OnInventoryLeftClick();
 void __cdecl OnGameViewportClick();
-bool __cdecl sub_4226C2();
+bool PauseGameDrawing();
 void __fastcall SetUserInterface(int a1, bool bReplace);
 void __cdecl reset_some_strus_flt_2Cs();
 void __cdecl j_sub_423B4A();
@@ -2019,7 +2019,7 @@
 void __cdecl DrawBranchlessDialogueUI();
 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4);
 void __cdecl sub_4452BB();
-const char *__fastcall sub_445308(int a1);
+const char *GetProfessionActionText(int a1);
 void __cdecl DrawDialogueUI();
 struct NPCData *__fastcall GetNPCData(unsigned int npcid);
 struct NPCData *__fastcall GetNewNPCData(signed int npcid, int a2);