changeset 177:c10509e439f1

Обращённый набор изменений: 05682713195c
author Ritor1
date Fri, 15 Feb 2013 10:39:18 +0600
parents 05682713195c
children 1dfa65be220e
files GUIFont.cpp GUIFont.h GUIWindow.cpp Sprites.cpp mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_data.h
diffstat 9 files changed, 282 insertions(+), 327 deletions(-) [+]
line wrap: on
line diff
--- a/GUIFont.cpp	Fri Feb 15 10:32:09 2013 +0600
+++ b/GUIFont.cpp	Fri Feb 15 10:39:18 2013 +0600
@@ -1,5 +1,5 @@
 #include <string>
-
+#include "LOD.h"
 #include "GUIFont.h"
 #include "GUIWindow.h"
 #include "Render.h"
@@ -7,7 +7,7 @@
 #include "mm7_data.h"
 
 
-
+extern LODFile_IconsBitmaps *pIcons_LOD;
 
 
 struct GUIFont *pAutonoteFont;
@@ -21,6 +21,33 @@
 struct GUIFont *pFontComic;
 struct GUIFont *pFontSmallnum;
 
+//----- (0044C448) --------------------------------------------------------
+GUIFont *LoadFont(const char *pFontFile, const char *pFontPalette, ...)
+	{
+	
+	int pallete_index; // eax@3
+	GUIFont *pFont;
+	unsigned int palletes_count =0;
+	va_list palettes_ptr;
+
+	pFont = (GUIFont *)pIcons_LOD->LoadRaw(pFontFile, 0);
+	va_start(palettes_ptr, pFontFile);
+
+	while  (NULL!=(pFontPalette=va_arg(palettes_ptr, const char *)))
+		{
+		pallete_index =pIcons_LOD->LoadTexture(pFontPalette, TEXTURE_16BIT_PALETTE);
+		if (pallete_index == -1)
+			{
+			wsprintfA(pTmpBuf, "Unable to open %s", pFontPalette);
+			Abortf(pTmpBuf);
+			}	
+		pFont->pFontPalettes[palletes_count] = pIcons_LOD->pTextures[pallete_index].pPalette16;
+		++palletes_count;
+		}
+	va_end(palettes_ptr);
+	pFont->palletes_count = palletes_count;
+	return pFont;
+	}
 
 
 
@@ -267,7 +294,7 @@
 
 
 //----- (0044C933) --------------------------------------------------------
-char *__fastcall GUIFont::_44C933(const char *pString, GUIFont *pFont, GUIFont *a3, int a4, int a5, int a6)
+char * GUIFont::_44C933(const char *pString, GUIFont *pFont, GUIFont *a3, int a4, int a5, int a6)
 {
   const char *v6; // esi@1
   size_t v8; // eax@3
@@ -576,127 +603,238 @@
 }
 
 //----- (0044C59D) --------------------------------------------------------
-int GUIFont::CalcTextHeight(const char *pString, GUIWindow *pWindow, int a4, int a5)
-{
-  const char *v5; // ebx@1
-  GUIFont *v6; // edi@1
-  int v8; // esi@3
-  size_t v9; // eax@3
-  signed int v10; // ebx@3
-  unsigned __int8 v11; // cl@4
-  size_t pWindowa; // [sp+10h] [bp+8h]@3
-  unsigned __int8 *uX; // [sp+14h] [bp+Ch]@3
+int GUIFont::CalcTextHeight(const char *pString, GUIWindow *pWindow, int uXOffset, int a5)
+	{ 
+	int uAllHeght; // esi@3
+	unsigned int uStringLen; // eax@3
+	char c; // cl@4
+	char *test_string; // [sp+14h] [bp+Ch]@3
 
-  v5 = pString;
-  v6 = this;
-  if ( !pString )
-    return 0;
-  v8 = LOBYTE(this->uFontHeight) - 3;
-  uX = (unsigned __int8 *)FitTextInAWindow(pString, this, pWindow, a4, 0);
-  v9 = strlen(v5);
-  v10 = 0;
-  pWindowa = v9;
-  while ( v10 < (signed int)pWindowa )
-  {
-    if ( v6->IsCharValid(v11 = *uX) )
-    {
-      if ( v11 == 9 )
-        goto LABEL_9;
-      switch ( v11 )
-      {
-        case 0xAu:
-          v8 = v8 + LOBYTE(v6->uFontHeight) - 3;
-          break;
-        case 0xCu:
-          uX += 5;
-          v10 += 5;
-          break;
-        case 0xDu:
-LABEL_9:
-          if ( a5 != 1 )
-          {
-            uX += 3;
-            v10 += 3;
-          }
-          break;
-      }
-    }
-    ++v10;
-    ++uX;
-  }
-  return v8;
-}
+	if (!pString)
+		return 0;
+	uAllHeght = this->uFontHeight - 3;
+	test_string = FitTextInAWindow(pString, this, pWindow, uXOffset, 0);
+	uStringLen = strlen(pString);
+	for (int i = 0; i < uStringLen; ++i)
+		{
+		c = test_string[i];
+		if (IsCharValid(c))
+			{
+			switch (c)
+				{
+			case '\n':	//Line Feed 0A 10:
+				uAllHeght+= this->uFontHeight - 3;
+				break;
+			case '\f':  //Form Feed, page eject  0C 12 
+				i += 5;		  
+				break;
+			case '\t':	// Horizontal tab 09
+			case '\r':   //Carriage Return 0D 13
+				if (a5 != 1)
+					i += 3;
+				break;
+				}
+			}
+		}
+	return uAllHeght;
+	}
 
 
 //----- (0044C51E) --------------------------------------------------------
 int GUIFont::GetLineWidth(const char *pString)
-{
-  GUIFont *pFont; // edi@1
-  size_t pNumLen; // ebp@3
-  int v5; // esi@3
-  signed int i; // ebx@3
-  unsigned __int8 v7; // cl@4
-  const char *pStr; // [sp+0h] [bp-4h]@1
+	{
+	unsigned int str_len; // ebp@3
+	int string_line_width; // esi@3
+	unsigned char c;
 
-  pStr = pString;
-  pFont = this;
-  if ( !pString ) // == 0
-    return 0;
-  pNumLen = strlen(pString);
-  v5 = 0;
-  for ( i = 0; i < (signed int)pNumLen; ++i )
-  {
-    if ( IsCharValid(v7 = pStr[i]) )
-    {
-      if ( v7 < 9u )
-      {
-        if ( i > 0 )
-          v5 += pFont->pMetrics[v7].uLeftSpacing;
-        v5 += *((int *)&pFont->cFirstChar + 3 * v7 + 9);
-        if ( i < (signed int)pNumLen )
-          v5 += pFont->pMetrics[v7].uRightSpacing;
-        continue;
-      }
-      if ( v7 <= 0xAu )
-        return v5;
-      if ( v7 != '\f' )
-      {
-        if ( v7 == '\r' )
-          return v5;
-        if ( i > 0 )
-          v5 += pFont->pMetrics[v7].uLeftSpacing;
-        v5 += *((int *)&pFont->cFirstChar + 3 * v7 + 9);
-        if ( i < (signed int)pNumLen )
-          v5 += pFont->pMetrics[v7].uRightSpacing;
-        continue;
-      }
-      i += 5;
-    }
-  }
-  return v5;
-}
-
-
+	if (!pString)
+		return 0;
+	str_len = strlen(pString);
+	string_line_width = 0;
+	for ( int i = 0; i < str_len; ++i )
+		{
+		c = pString[i];
+		if (IsCharValid(c))
+			{
+			switch (c)
+				{
+			case '\t':
+			case '\n':
+			case '\r':
+				return string_line_width;
+			case '\f':
+				i += 5;	  
+				break;
+			default:
+				if (i > 0)
+					string_line_width += this->pMetrics[c].uLeftSpacing;
+				string_line_width += this->pMetrics[c].uWidth;
+				if (i < str_len)
+					string_line_width +=this->pMetrics[c].uRightSpacing;
+				}
+			}
+		}
+	return string_line_width;
+	}
 
 
 //----- (0044C502) --------------------------------------------------------
 int GUIFont::AlignText_Center(unsigned int uCenterX, const char *pString)
 {
-  signed int v3; // esi@1
-  signed int result; // eax@2
+  signed int position; // esi@1
+ 
+  position = (signed int)(uCenterX - GetLineWidth(pString)) >> 1;
+  if ( position >= 0 )
+    return position;
+  else
+    return  0;
 
-  v3 = (signed int)(uCenterX - GetLineWidth(pString)) >> 1;
-  if ( v3 >= 0 )
-    result = v3;
-  else
-    result = 0;
-  return result;
 }
 
+//----- (0044C768) --------------------------------------------------------
+char * FitTextInAWindow(const char *pInString, GUIFont *pFont, GUIWindow *pWindow, unsigned int uX, int a5)
+	{
+	const char *v5; // edi@1
+	GUIFont *v6; // esi@1
+	unsigned int v8; // eax@3
+	int v9; // edi@3
+	unsigned __int8 v10; // cl@4
+	int v11; // edx@10
+	GUICharMetric *v12; // ecx@10
+	int v13; // edx@11
+	int v14; // edx@12
+	int v15; // edx@13
+	unsigned int v16; // esi@15
+	unsigned int v17; // edx@15
+	unsigned int v18; // ecx@15
+	int v19; // ebx@16
+	unsigned __int8 v20; // zf@16
+	char v21; // sf@16
+	unsigned __int8 v22; // of@16
+	int v23; // edi@16
+	unsigned __int8 v24; // dl@17
+	int v25; // edi@39
+	int v26; // eax@42
+	std::string v27; // [sp-18h] [bp-40h]@2
+	const char *v28; // [sp-8h] [bp-30h]@2
+	int v29; // [sp-4h] [bp-2Ch]@2
+	const char *v30; // [sp+Ch] [bp-1Ch]@1
+	char Str[3]; // [sp+10h] [bp-18h]@42
+	char v32; // [sp+13h] [bp-15h]@42
+	size_t v33; // [sp+14h] [bp-14h]@3
+	unsigned int v34; // [sp+18h] [bp-10h]@3
+	GUIFont *v35; // [sp+1Ch] [bp-Ch]@1
+	int v36; // [sp+20h] [bp-8h]@3
+	int v37; // [sp+24h] [bp-4h]@3
 
-//----- (0044C4DE) --------------------------------------------------------
-bool GUIFont::IsCharValid(char _c)
-{
-  unsigned char c = _c;
-  return c >= cFirstChar && c <= cLastChar || c == '\f' || c == '\r' || c == '\t' || c == '\n';
-}
\ No newline at end of file
+	v5 = pInString;
+	v6 = pFont;
+	v30 = pInString;
+	v35 = pFont;
+	if ( !pInString )
+		{
+		MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:445", 0);
+		return 0;
+		}
+	v33 = strlen(pInString);
+	strcpy(pTmpBuf3, v5);
+	v8 = uX;
+	v9 = 0;
+	v36 = 0;
+	v34 = uX;
+	v37 = 0;
+	if ( (signed int)v33 > 0 )
+		{
+		while ( 1 )
+			{
+			v10 = pTmpBuf3[v9];
+			if ((v10 < v6->cFirstChar || v10 > v6->cLastChar)
+				&& v10 != '\f' && v10 != '\r' && v10 != '\t' && v10 != '\n' )
+				goto LABEL_34;
+			v11 = v10 - 9;
+			v12 = &v6->pMetrics[v10];
+			if ( !v11 )
+				{
+				strncpy(Str, &pTmpBuf3[v9 + 1], 3u);
+				v32 = 0;
+				v26 = atoi(Str);
+				v8 = uX + v26;
+				v25 = v9 + 3;
+				v34 = v8;
+				goto LABEL_43;
+				}
+			v13 = v11 - 1;
+			if ( !v13 )
+				break;
+			v14 = v13 - 2;
+			if ( !v14 )
+				{
+				v25 = v9 + 5;
+LABEL_43:
+				v37 = v25;
+				goto LABEL_34;
+				}
+			v15 = v14 - 1;
+			if ( v15 )
+				{
+				if ( v15 != 19 )
+					{
+					v16 = v12->uRightSpacing;
+					v17 = v12->uWidth;
+					v18 = v12->uLeftSpacing;
+					if ( v8 + v16 + v18 + v17 < pWindow->uFrameWidth )
+						{
+						if ( v37 > v36 )
+							v8 += v18;
+						v8 += v17;
+						if ( v37 < (signed int)v33 )
+							v8 += v16;
+						v6 = v35;
+						}
+					else
+						{
+						v19 = v36;
+						v8 = v34;
+						v22 = v36 > v37;
+						v20 = v36 == v37;
+						v21 = v36 - v37 < 0;
+						v6 = v35;
+						pTmpBuf3[v36] = 10;
+						v23 = v19;
+						if ( (unsigned __int8)(v21 ^ v22) | v20 )
+							{
+							do
+								{
+								v24 = pTmpBuf3[v23];
+								if ( v24 >= v6->cFirstChar && v24 <= v6->cLastChar || v24 == 12 || v24 == 13 || v24 == 9 || v24 == 10 )
+									{
+									if ( v23 > v19 )
+										v8 += v6->pMetrics[v24].uLeftSpacing;
+									v8 += *((int *)&v6->cFirstChar + 3 * v24 + 9);
+									if ( v23 < v37 )
+										v8 += v6->pMetrics[v24].uRightSpacing;
+									}
+								++v23;
+								}
+								while ( v23 <= v37 );
+							}
+						}
+					goto LABEL_34;
+					}
+				v8 += v12->uWidth;
+				goto LABEL_41;
+				}
+			if ( !a5 )
+				return (char *)v30;
+LABEL_34:
+			v9 = v37++ + 1;
+			if ( v37 >= (signed int)v33 )
+				return pTmpBuf3;
+			}
+		v8 = v34;
+LABEL_41:
+		v36 = v9;
+		goto LABEL_34;
+		}
+	return pTmpBuf3;
+	}
--- a/GUIFont.h	Fri Feb 15 10:32:09 2013 +0600
+++ b/GUIFont.h	Fri Feb 15 10:39:18 2013 +0600
@@ -15,7 +15,9 @@
 #pragma pack(push, 1)
 struct GUIFont
 {
-  bool IsCharValid(char c);
+	
+//----- (0044C4DE) --------------------------------------------------------
+  bool IsCharValid(char c) {	return (c >= cFirstChar) && (c <= cLastChar) || (c == '\f') || (c == '\r') || (c == '\t') || (c == '\n');}
   int AlignText_Center(unsigned int uCenterX, const char *pString);
   int GetLineWidth(const char *pString);
   int CalcTextHeight(const char *pString, struct GUIWindow *pWindow, int a4, int a5);
@@ -25,7 +27,7 @@
   void DrawTextLine(unsigned int uDefaultColor, signed int uX, signed int uY, const char *Str, int a6);
   void _44D2FD_prolly_draw_credits_entry(GUIFont *pFont, int Str, int a4, unsigned int w, unsigned int h, unsigned __int16 a7, unsigned __int16 a8, const char *pString, unsigned __int16 *pPixels, unsigned int uPixelsWidth);
 
-  static char *__fastcall _44C933(const char *pString, GUIFont *pFont, GUIFont *a3, int a4, int a5, int a6);
+  static char * _44C933(const char *pString, GUIFont *pFont, GUIFont *a3, int a4, int a5, int a6);
 
   unsigned char cFirstChar;
   unsigned char cLastChar;
@@ -34,15 +36,15 @@
   char field_4;
   __int16 uFontHeight;
   char field_7;
-  int field_8;
+  int palletes_count;
   unsigned __int16 *pFontPalettes[5];
   GUICharMetric pMetrics[256];
   int field_C20[256];
 };
 #pragma pack(pop)
 
-
-
+GUIFont *LoadFont(const char *pFontFile, const char *pFontPalette, ...);
+char * FitTextInAWindow(const char *pInString, GUIFont *pFont, GUIWindow *pWindow, unsigned int uX, int a5);
 
 
 extern struct GUIFont *pAutonoteFont;
--- a/GUIWindow.cpp	Fri Feb 15 10:32:09 2013 +0600
+++ b/GUIWindow.cpp	Fri Feb 15 10:39:18 2013 +0600
@@ -922,10 +922,10 @@
     pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
   pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0);
   pTexture_mapbordr = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("mapbordr", TEXTURE_16BIT_PALETTE)];
-  pBookFont = LoadFont("book.fnt", "FONTPAL", 0);
-  pBook2Font = LoadFont("book2.fnt", "FONTPAL", 0);
-  pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", 0);
-  pSpellFont = LoadFont("spell.fnt", "FONTPAL", 0);
+  pBookFont = LoadFont("book.fnt", "FONTPAL", NULL);
+  pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL);
+  pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL);
+  pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL);
 }
 
 //----- (00411B59) --------------------------------------------------------
--- a/Sprites.cpp	Fri Feb 15 10:32:09 2013 +0600
+++ b/Sprites.cpp	Fri Feb 15 10:39:18 2013 +0600
@@ -11,7 +11,7 @@
 
 
 
-extern int (__cdecl *sprintfex)(char *a1, const char *a2, ...);
+//extern int (__cdecl *sprintfex)(char *a1, const char *a2, ...);
 
 struct SpriteFrameTable *pSpriteFrameTable;
 
--- a/mm7_1.cpp	Fri Feb 15 10:32:09 2013 +0600
+++ b/mm7_1.cpp	Fri Feb 15 10:39:18 2013 +0600
@@ -1607,11 +1607,11 @@
   pRenderer->ResetClip();
 
   uTextureID_FONTPAL = pIcons_LOD->LoadTexture("FONTPAL", TEXTURE_16BIT_PALETTE);
-  pFontArrus = LoadFont("arrus.fnt", "FONTPAL", 0);
-  pFontLucida = LoadFont("lucida.fnt", "FONTPAL", 0);
-  pFontCreate = LoadFont("create.fnt", "FONTPAL", 0);
-  pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", 0);
-  pFontComic = LoadFont("comic.fnt", "FONTPAL", 0);
+  pFontArrus = LoadFont("arrus.fnt", "FONTPAL", NULL);
+  pFontLucida = LoadFont("lucida.fnt", "FONTPAL", NULL);
+  pFontCreate = LoadFont("create.fnt", "FONTPAL", NULL);
+  pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", NULL);
+  pFontComic = LoadFont("comic.fnt", "FONTPAL", NULL);
   pFontArrus->field_3 = 0;
   pFontLucida->field_3 = 0;
   pFontCreate->field_3 = 0;
--- a/mm7_2.cpp	Fri Feb 15 10:32:09 2013 +0600
+++ b/mm7_2.cpp	Fri Feb 15 10:39:18 2013 +0600
@@ -5104,7 +5104,7 @@
   pWindow.uFrameHeight = 338;
   pWindow.uFrameZ = 543;
   pWindow.uFrameW = 397;
-  pFont = LoadFont("endgame.fnt", "FONTPAL", 0);
+  pFont = LoadFont("endgame.fnt", "FONTPAL", NULL);
   if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 99) )
   {
     v1 = pGlobalTXT_LocalizationStrings[675];
@@ -13899,9 +13899,11 @@
   unsigned int startms; // [sp+8h] [bp-24h]@55
   RECT Rect; // [sp+Ch] [bp-20h]@15
   int a2[4]; // [sp+1Ch] [bp-10h]@15
-
+#ifdef MM7_TEXT_DLL
   auto mm7text_dll = LoadLibraryW(L"mm7text.dll");
   sprintfex = (int (__cdecl *)(char *a1, const char *a2, ...))GetProcAddress(mm7text_dll, "_sprintfex");
+#endif
+
 
   if (pCmdLine && *pCmdLine)
   {
--- a/mm7_3.cpp	Fri Feb 15 10:32:09 2013 +0600
+++ b/mm7_3.cpp	Fri Feb 15 10:39:18 2013 +0600
@@ -20389,198 +20389,11 @@
   v1->z = LODWORD(v14);
 }
 
-//----- (0044C448) --------------------------------------------------------
-GUIFont *LoadFont(const char *pFontFile, const char *pFontPalette, ...)
-{
-  GUIFont *result; // eax@1
-  const char *v3; // edi@1
-  const char **v4; // ebx@2
-  unsigned int v5; // eax@3
-  unsigned __int16 **v6; // ecx@6
-  GUIFont *v7; // [sp+4h] [bp-Ch]@1
-  int v8; // [sp+8h] [bp-8h]@1
-  unsigned __int16 **v9; // [sp+Ch] [bp-4h]@2
-
-  result = (GUIFont *)pIcons_LOD->LoadRaw(pFontFile, 0);
-  v3 = pFontPalette;
-  v8 = 0;
-  v7 = result;
-  if ( pFontPalette )
-  {
-    v4 = &pFontPalette;
-    v9 = result->pFontPalettes;
-    do
-    {
-      v5 = pIcons_LOD->LoadTexture(v3, TEXTURE_16BIT_PALETTE);
-      if ( v5 == -1 )
-      {
-        sprintf(pTmpBuf, "Unable to open %s", v3);
-        Abortf(pTmpBuf);
-      }
-      ++v4;
-      v6 = v9;
-      v3 = *v4;
-      ++v8;
-      ++v9;
-      *v6 = (v5 != -1 ? pIcons_LOD->pTextures[v5].pPalette16 : 0);
-    }
-    while ( v3 );
-    result = v7;
-  }
-  result->field_8 = v8;
-  return result;
-}
-
-
-
-
-//----- (0044C768) --------------------------------------------------------
-char *__fastcall FitTextInAWindow(const char *pInString, GUIFont *pFont, GUIWindow *pWindow, unsigned int uX, int a5)
-{
-  const char *v5; // edi@1
-  GUIFont *v6; // esi@1
-  unsigned int v8; // eax@3
-  int v9; // edi@3
-  unsigned __int8 v10; // cl@4
-  int v11; // edx@10
-  GUICharMetric *v12; // ecx@10
-  int v13; // edx@11
-  int v14; // edx@12
-  int v15; // edx@13
-  unsigned int v16; // esi@15
-  unsigned int v17; // edx@15
-  unsigned int v18; // ecx@15
-  int v19; // ebx@16
-  unsigned __int8 v20; // zf@16
-  char v21; // sf@16
-  unsigned __int8 v22; // of@16
-  int v23; // edi@16
-  unsigned __int8 v24; // dl@17
-  int v25; // edi@39
-  int v26; // eax@42
-  std::string v27; // [sp-18h] [bp-40h]@2
-  const char *v28; // [sp-8h] [bp-30h]@2
-  int v29; // [sp-4h] [bp-2Ch]@2
-  const char *v30; // [sp+Ch] [bp-1Ch]@1
-  char Str[3]; // [sp+10h] [bp-18h]@42
-  char v32; // [sp+13h] [bp-15h]@42
-  size_t v33; // [sp+14h] [bp-14h]@3
-  unsigned int v34; // [sp+18h] [bp-10h]@3
-  GUIFont *v35; // [sp+1Ch] [bp-Ch]@1
-  int v36; // [sp+20h] [bp-8h]@3
-  int v37; // [sp+24h] [bp-4h]@3
-
-  v5 = pInString;
-  v6 = pFont;
-  v30 = pInString;
-  v35 = pFont;
-  if ( !pInString )
-  {
-    MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:445", 0);
-    return 0;
-  }
-  v33 = strlen(pInString);
-  strcpy(pTmpBuf3, v5);
-  v8 = uX;
-  v9 = 0;
-  v36 = 0;
-  v34 = uX;
-  v37 = 0;
-  if ( (signed int)v33 > 0 )
-  {
-    while ( 1 )
-    {
-      v10 = pTmpBuf3[v9];
-      if ((v10 < v6->cFirstChar || v10 > v6->cLastChar)
-          && v10 != '\f' && v10 != '\r' && v10 != '\t' && v10 != '\n' )
-        goto LABEL_34;
-      v11 = v10 - 9;
-      v12 = &v6->pMetrics[v10];
-      if ( !v11 )
-      {
-        strncpy(Str, &pTmpBuf3[v9 + 1], 3u);
-        v32 = 0;
-        v26 = atoi(Str);
-        v8 = uX + v26;
-        v25 = v9 + 3;
-        v34 = v8;
-        goto LABEL_43;
-      }
-      v13 = v11 - 1;
-      if ( !v13 )
-        break;
-      v14 = v13 - 2;
-      if ( !v14 )
-      {
-        v25 = v9 + 5;
-LABEL_43:
-        v37 = v25;
-        goto LABEL_34;
-      }
-      v15 = v14 - 1;
-      if ( v15 )
-      {
-        if ( v15 != 19 )
-        {
-          v16 = v12->uRightSpacing;
-          v17 = v12->uWidth;
-          v18 = v12->uLeftSpacing;
-          if ( v8 + v16 + v18 + v17 < pWindow->uFrameWidth )
-          {
-            if ( v37 > v36 )
-              v8 += v18;
-            v8 += v17;
-            if ( v37 < (signed int)v33 )
-              v8 += v16;
-            v6 = v35;
-          }
-          else
-          {
-            v19 = v36;
-            v8 = v34;
-            v22 = v36 > v37;
-            v20 = v36 == v37;
-            v21 = v36 - v37 < 0;
-            v6 = v35;
-            pTmpBuf3[v36] = 10;
-            v23 = v19;
-            if ( (unsigned __int8)(v21 ^ v22) | v20 )
-            {
-              do
-              {
-                v24 = pTmpBuf3[v23];
-                if ( v24 >= v6->cFirstChar && v24 <= v6->cLastChar || v24 == 12 || v24 == 13 || v24 == 9 || v24 == 10 )
-                {
-                  if ( v23 > v19 )
-                    v8 += v6->pMetrics[v24].uLeftSpacing;
-                  v8 += *((int *)&v6->cFirstChar + 3 * v24 + 9);
-                  if ( v23 < v37 )
-                    v8 += v6->pMetrics[v24].uRightSpacing;
-                }
-                ++v23;
-              }
-              while ( v23 <= v37 );
-            }
-          }
-          goto LABEL_34;
-        }
-        v8 += v12->uWidth;
-        goto LABEL_41;
-      }
-      if ( !a5 )
-        return (char *)v30;
-LABEL_34:
-      v9 = v37++ + 1;
-      if ( v37 >= (signed int)v33 )
-        return pTmpBuf3;
-    }
-    v8 = v34;
-LABEL_41:
-    v36 = v9;
-    goto LABEL_34;
-  }
-  return pTmpBuf3;
-}
+
+
+
+
+
 //----- (00401000) --------------------------------------------------------
 void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int))
 {
--- a/mm7_4.cpp	Fri Feb 15 10:32:09 2013 +0600
+++ b/mm7_4.cpp	Fri Feb 15 10:39:18 2013 +0600
@@ -5831,7 +5831,7 @@
                                  (Texture *)(uTextureID_BUTTMAKE2 != -1 ? &pIcons_LOD->pTextures[uTextureID_BUTTMAKE2] : 0), 0);
   pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, 0x3F, 0, 0x2D, "", pTexture_buttminu, 0);
   pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, 0x3E, 1, 0x2B, "", pTexture_buttplus, 0);
-  pFontCChar = LoadFont("cchar.fnt", "FONTPAL", 0);
+  pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL);
 }
 // 4E28F8: using guessed type int pCurrentScreen;
 
@@ -6158,8 +6158,8 @@
   Texture pTexture3; // [sp+Ch] [bp-130h]@5
   
   a5 = 0;
-  pFontQuick = LoadFont("quick.fnt", "FONTPAL", 0);
-  pFontCChar = LoadFont("cchar.fnt", "FONTPAL", 0);
+  pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL);
+  pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL);
   if ( pMessageQueue_50CBD0->uNumMessages )
     pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
   ++pIcons_LOD->uTexturePacksCount;
--- a/mm7_data.h	Fri Feb 15 10:32:09 2013 +0600
+++ b/mm7_data.h	Fri Feb 15 10:39:18 2013 +0600
@@ -310,7 +310,7 @@
 
 //-------------------------------------------------------------------------
 // Data declarations
-extern int (__cdecl *sprintfex)(char *a1, const char *a2, ...);
+//extern int (__cdecl *sprintfex)(char *a1, const char *a2, ...);
 
 extern int pWindowList_at_506F50_minus1_indexing[1];
 extern int dword_4C9890[10]; // weak
@@ -2054,8 +2054,8 @@
 signed int __cdecl const_2();
 bool __cdecl sub_44C28F_open_nwc_dungeon();
 // int __cdecl crt_deconstruct_44C42C();
-struct GUIFont *LoadFont(const char *pFontFile, const char *pFontPalette, ...);
-char *__fastcall FitTextInAWindow(const char *pInString, GUIFont *pFont, GUIWindow *pWindow, unsigned int uX, int a5);
+
+
 void SpawnEncounter(struct MapInfo *pMapInfo, struct SpawnPointMM7 *spawn, int a3, int a4, int a5);
 int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3);
 void __cdecl sub_450218_prolly_generate_chests_loot();