changeset 1160:502b8b2e36b4

font cleaning
author Gloval
date Tue, 04 Jun 2013 01:37:23 +0400
parents 8ce08eea96ed
children d8f0f1a70b91
files GUIFont.cpp GUIFont.h GUIWindow.cpp Player.h UIBooks.cpp UIHouses.h mm7_3.cpp mm7_5.cpp mm7_6.cpp mm7_data.cpp mm7_data.h
diffstat 11 files changed, 241 insertions(+), 325 deletions(-) [+]
line wrap: on
line diff
--- a/GUIFont.cpp	Sun Jun 02 22:16:58 2013 +0400
+++ b/GUIFont.cpp	Tue Jun 04 01:37:23 2013 +0400
@@ -27,38 +27,42 @@
 
 char pTmpBuf3[10000];
 
+void DrawCharToBuff(unsigned short* uXpos,unsigned char* pCharPixels, int uCharWidth, int uCharHeight, unsigned __int16* pFontPalette, __int16 draw_color, int line_width);
+
+
 //----- (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;
+{	
+    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);
+    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;
-	}
+    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;
+}
 
 
 
 //----- (0044D2FD) --------------------------------------------------------
-void GUIFont::_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)
+void GUIFont::_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)
 {
   int v11; // ebx@1
   int v12; // edi@1
@@ -114,7 +118,7 @@
       v18 = (signed int)(w - v16->GetLineWidth(&v14[v17])) >> 1;
       if ( v18 < 0 )
         v18 = 0;
-      v16->_44D0B5(a4a, a8, (int)&v15[v18 + a7a], Stra, uPixelsWidth);
+      v16->DrawTextLineToBuff(a4a, a8, &v15[v18 + a7a], Stra, uPixelsWidth);
       v15 += uPixelsWidth * (LOBYTE(v16->uFontHeight) - 3);
       Stra = strtok(0, "\n");
       if ( !Stra )
@@ -127,176 +131,151 @@
 
 
 //----- (0044D1E7) --------------------------------------------------------
-void GUIFont::DrawTextLine(unsigned int uDefaultColor, signed int uX, signed int uY, const char *Str, int a6)
+void GUIFont::DrawTextLine( unsigned int uDefaultColor, signed int uX, signed int uY, 
+                            const char *text, int max_len_pix )
 {
-  size_t v6; // ebx@1
-  GUIFont *pFont; // esi@1
-  signed int v8; // edi@3
-  unsigned __int8 v9; // cl@4
-  int v10; // eax@5
-  int v11; // ecx@5
-  int v12; // ecx@6
-  int v13; // ecx@7
-  int v14; // ecx@9
-  unsigned int v15; // edx@9
-  unsigned __int16 v16; // cx@12
-  unsigned __int8 *v17; // eax@12
-  char Dest[20]; // [sp+Ch] [bp-1Ch]@16
-  //char v19; // [sp+11h] [bp-17h]@16
-  size_t v20; // [sp+20h] [bp-8h]@2
-  int v21; // [sp+24h] [bp-4h]@1
-  int uXa; // [sp+30h] [bp+8h]@9
+    signed int uX_pos; // edi@3
+    unsigned char c; // cl@4
+    unsigned __int16 draw_color; // cx@12
+    unsigned __int8 *pCharPixels; // eax@12
+    char color_code[20]; // [sp+Ch] [bp-1Ch]@16
+    int text_length; // [sp+20h] [bp-8h]@2
+    int text_color; // [sp+24h] [bp-4h]@1
+    int uCharWidth; // [sp+30h] [bp+8h]@9
 
-  v6 = 0;
-  v21 = uDefaultColor;
-  pFont = this;
-  if ( Str )
-  {
-    v21 = ui_current_text_color;
-    v20 = strlen(Str);
-    if ( (signed int)v20 > 0 )
-    {
-      v8 = uX;
-      do
-      {
-        if ( pFont->IsCharValid(v9 = Str[v6]) )
+    if ( !text )
+        return;
+    text_color = ui_current_text_color;
+    text_length = strlen(text);
+    uX_pos=uX;
+    for (int i=0; i<text_length; ++i )
         {
-          v10 = v9;
-          v11 = v9 - 9;
-          if ( v11 )
-          {
-            v12 = v11 - 1;
-            if ( !v12 )
-              return;
-            v13 = v12 - 2;
-            if ( v13 )
+        c = text[i];
+        if ( IsCharValid(c) )
             {
-              if ( v13 != 1 )
-              {
-                v14 = 3 * v10 + 9;
-                v15 = *((int *)&pFont->cFirstChar + v14);
-                uXa = *((int *)&pFont->cFirstChar + v14);
-                if ( v15 )
+            switch (c)
                 {
-                  if ( (signed int)v6 > 0 )
-                    v8 += pFont->pMetrics[v10].uLeftSpacing;
-                  v16 = v21;
-                  v17 = (unsigned __int8 *)((char *)&pFont[1] + pFont->field_C20[v10]);
-                  if ( !v21 )
-                    v16 = -1;
-                  pRenderer->DrawText(v8, uY, v17, v15, pFont->uFontHeight, pFont->pFontPalettes[0], v16, 0);
-                  v8 += uXa;
-                  if ( (signed int)v6 < (signed int)v20 )
-                    v8 += pFont->pMetrics[(unsigned __int8)Str[v6]].uRightSpacing;
+            case '\n':	//Line Feed 0A 10:
+                return;
+                break;
+            case '\f':  //Form Feed, page eject  0C 12 
+                strncpy(color_code, &text[i + 1], 5);
+                color_code[5] = 0;
+                text_color = atoi(color_code);
+                ui_current_text_color = text_color;
+                i += 5;	  
+                break;
+            case '\t':	// Horizontal tab 09
+            case '\r':   //Carriage Return 0D 13                 
+                break;
+            default:
+                uCharWidth = pMetrics[c].uWidth;
+                if ( uCharWidth )
+                    {
+                    if ( i > 0 )
+                        uX_pos += pMetrics[c].uLeftSpacing;
+                    draw_color = text_color;
+                    pCharPixels = &pFontData[font_pixels_offset[c]];
+                    if ( !text_color )
+                        draw_color = -1;
+                    pRenderer->DrawText(uX_pos, uY, pCharPixels, uCharWidth, uFontHeight, pFontPalettes[0], draw_color, 0);
+                    uX_pos += uCharWidth;
+                    if ( i < text_length )
+                        uX_pos += pMetrics[c].uRightSpacing;
+                    }
                 }
-              }
             }
-            else
+        }
+    
+}
+
+//----- (0040F845) --------------------------------------------------------
+void DrawCharToBuff( unsigned short* uXpos,unsigned char* pCharPixels, int uCharWidth, int uCharHeight, 
+                            unsigned __int16* pFontPalette, __int16 draw_color, int line_width )
+    {
+    unsigned __int16* draw_buff; // edi@1
+    unsigned char* pPixels; // esi@1
+    unsigned char char_pxl; // eax@3
+
+    draw_buff = uXpos;
+    pPixels = pCharPixels;
+    for(int i=0; i<uCharHeight; ++i)
+        {
+        for(int j=0; j<uCharWidth; ++j)
             {
-              strncpy(Dest, &Str[v6 + 1], 5u);
-              Dest[5] = 0;
-              v21 = atoi(Dest);
-              ui_current_text_color = v21;
-              v6 += 5;
+            char_pxl = *pPixels++;
+            if ( char_pxl )
+                {
+                if ( char_pxl == 1 )
+                    *draw_buff = pFontPalette[1];         
+                else         
+                    *draw_buff = draw_color;         
+                }
+            ++draw_buff;
             }
-          }
+        draw_buff+=line_width-uCharWidth;
         }
-        ++v6;
-      }
-      while ( (signed int)v6 < (signed int)v20 );
-    }
-  }
+
 }
-// 5C6DB4: using guessed type int ui_current_text_color;
-
 
 //----- (0044D0B5) --------------------------------------------------------
-void GUIFont::_44D0B5(int a2, int a3, int a4, const char *pString, int a6)
-{
-  int v6; // ebx@1
-  GUIFont *v7; // esi@1
-  int v8; // edi@3
-  unsigned __int8 v9; // cl@4
-  int v10; // eax@5
-  int v11; // ecx@5
-  int v12; // ecx@6
-  int v13; // ecx@7
-  int v14; // ecx@8
-  int v15; // ebx@10
-  int v16; // edx@13
-  __int16 v17; // ax@13
-  char Dest; // [sp+Ch] [bp-20h]@17
-  char v19; // [sp+11h] [bp-1Bh]@17
-  size_t v20; // [sp+20h] [bp-Ch]@2
-  int v21; // [sp+24h] [bp-8h]@1
-  int v22; // [sp+28h] [bp-4h]@2
-  const char *v23; // [sp+38h] [bp+Ch]@4
+void GUIFont::DrawTextLineToBuff( int uColor, int a3, unsigned short* uX_buff_pos, const char *text, int line_width )
+    {
+  
+  unsigned short* uX_pos; // edi@3
+  unsigned char c; // cl@4
+  unsigned __int16 draw_color; // cx@12
+  unsigned __int8 *pCharPixels; // eax@12
+  char color_code[20]; // [sp+Ch] [bp-1Ch]@16
+  int text_length; // [sp+20h] [bp-8h]@2
+  int text_color; // [sp+24h] [bp-4h]@1
+  int uCharWidth; // [sp+30h] [bp+8h]@9
 
-  v6 = 0;
-  v21 = a2;
-  v7 = this;
-  if ( pString )
-  {
-    v21 = ui_current_text_color;
-    v20 = strlen(pString);
-    v22 = 0;
-    if ( (signed int)v20 > 0 )
-    {
-      v8 = a4;
-      do
+  if ( !text )
+      return;
+  text_color = ui_current_text_color;
+  text_length = strlen(text);
+  uX_pos=uX_buff_pos;
+  for (int i=0; i<text_length; ++i )
       {
-        v23 = &pString[v6];
-        if ( v7->IsCharValid(v9 = pString[v6]) )
-        {
-          v10 = v9;
-          v11 = v9 - 9;
-          if ( v11 )
+      c = text[i];
+      if ( IsCharValid(c) )
           {
-            v12 = v11 - 1;
-            if ( !v12 )
+          switch (c)
+              {
+          case '\n':	//Line Feed 0A 10:
               return;
-            v13 = v12 - 2;
-            if ( v13 )
-            {
-              v14 = v13 - 1;
-              if ( v14 )
-              {
-                if ( v14 != 82 )
-                {
-                  v15 = *((int *)&v7->cFirstChar + 3 * v10 + 9);
-                  if ( v15 )
+              break;
+          case '\f':  //Form Feed, page eject  0C 12 
+              strncpy(color_code, &text[i + 1], 5);
+              color_code[5] = 0;
+              text_color = atoi(color_code);
+              ui_current_text_color = text_color;
+              i += 5;	  
+              break;
+          case '\t':	// Horizontal tab 09
+          case '\r':   //Carriage Return 0D 13                 
+              break;
+          default:
+              uCharWidth = pMetrics[c].uWidth;
+              if ( uCharWidth )
                   {
-                    if ( v22 > 0 )
-                      v8 += 2 * v7->pMetrics[v10].uLeftSpacing;
-                    v16 = (int)((char *)&v7[1] + v7->field_C20[v10]);
-                    v17 = v21;
-                    if ( !v21 )
-                      v17 = -1;
-                    sub_40F845(v8, v16, v15, LOBYTE(v7->uFontHeight), (int)v7->pFontPalettes[0], v17, 2 * a6);
-                    v8 += 2 * v15;
-                    if ( v22 < (signed int)v20 )
-                      v8 += 2 * v7->pMetrics[(unsigned __int8)*v23].uRightSpacing;
+                  if ( i > 0 )
+                      uX_pos += pMetrics[c].uLeftSpacing;
+                  draw_color = text_color;
+                  pCharPixels = &pFontData[font_pixels_offset[c]];
+                  if ( !text_color )
+                      draw_color = -1;
+                  DrawCharToBuff(uX_pos, pCharPixels, uCharWidth, uFontHeight, pFontPalettes[0], draw_color, line_width);
+                  uX_pos += uCharWidth;
+                  if ( i < text_length )
+                      uX_pos += pMetrics[c].uRightSpacing;
                   }
-                }
               }
-            }
-            else
-            {
-              strncpy(&Dest, &pString[v6 + 1], 5u);
-              v19 = 0;
-              v21 = atoi(&Dest);
-              ui_current_text_color = v21;
-              v22 = v6 + 5;
-            }
           }
-        }
-        v6 = v22++ + 1;
       }
-      while ( v22 < (signed int)v20 );
-    }
-  }
 }
-// 5C6DB4: using guessed type int ui_current_text_color;
+
 
 
 //----- (0044C933) --------------------------------------------------------
@@ -490,71 +469,46 @@
 
 
 //----- (0044C6C2) --------------------------------------------------------
-int GUIFont::_44C6C2(const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5)
-{
-  const char *v5; // esi@1
-  int v6; // edi@1
-  unsigned __int8 *v8; // ebx@3
-  size_t v9; // eax@3
-  signed int v10; // esi@3
-  int v11; // edx@4
-  unsigned int v12; // cl@4
-  GUIFont *v13; // [sp+Ch] [bp-4h]@1
-  size_t uXa; // [sp+1Ch] [bp+Ch]@3
+char* GUIFont::_44C6C2( const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5 )
+    {
+  int text_height; // edi@1
+  char *text_str; // ebx@3
+  int i;
+  unsigned char c; // cl@4
+  int text_length; 
 
-  auto pFont = this;
-  v5 = pInString;
-  v6 = 0;
-  v13 = pFont;
+  text_height = 0;
+
   if ( !pInString )
     return 0;
-  v8 = (unsigned __int8 *)FitTextInAWindow(pInString, pFont, pWindow, uX, 0);
-  v9 = strlen(v5);
-  v10 = 0;
-  uXa = v9;
-  if ( (signed int)v9 > 0 )
-  {
-    while ( v10 < (signed int)uXa )
-    {
-	  if(IsCharValid(*v8))
-	  {
-		v12=(unsigned int)v8;
-		if ( v12 != 9 )
-		{
-		  if ( v12 == 10 )
-		  {
-			v6 = v6 + *(char *)(v11 + 5) - 3;
-			if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) )
-			  return (int)(v8 + 1);
-			if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) )
-			  return (int)v8;
-		  }
-		  else if ( v12 == 12 )
-		  {
-			v8 += 5;
-			v10 += 5;
-			if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) )
-			  return (int)v8;
-		  }
-		  else if ( v12 != 13 )
-		  {
-			if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) )
-			  return (int)v8; 
-		  }
-		}
-		if(v12 == 13 || v12 == 9)
-		{
-			v8 += 3;
-			v10 += 3;
-		}
-		if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) )
-		  return (int)v8;
-	  }
-      ++v10;
-      ++v8;
-    }
-  }
-  return (int)v8;
+  text_str = FitTextInAWindow(pInString, this, pWindow, uX, 0);
+  text_length = strlen(text_str);
+  //uX_pos=uX_buff_pos;
+  for (i=0; i<text_length; ++i )
+      {
+      c = text_str[i];
+      if ( IsCharValid(c) )
+          {
+          switch (c)
+              {
+          case '\n':	//Line Feed 0A 10:
+              text_height = text_height + uFontHeight - 3;
+              if ( text_height >= (signed int)(a5 * pWindow->uFrameHeight) )
+                  return &text_str[i+1];
+              break;
+          case '\f':  //Form Feed, page eject  0C 12       
+              i += 5;	  
+              break;
+          case '\t':	// Horizontal tab 09
+          case '\r':   //Carriage Return 0D 13 
+              i += 3;
+              break;    
+              }
+          if ( text_height >= (signed int)(a5 * pWindow->uFrameHeight) )
+              return &text_str[i];
+          }
+      }
+  return &text_str[i];
 }
 
 
@@ -611,11 +565,11 @@
 }
 
 //----- (0044C59D) --------------------------------------------------------
-int GUIFont::CalcTextHeight(const char *pString, GUIWindow *pWindow, int uXOffset, int a5)
-	{ 
+int GUIFont::CalcTextHeight( const char *pString, struct GUIWindow *pWindow, int uXOffset, int a5 )
+    { 
 	int uAllHeght; 
-	unsigned int uStringLen; 
-	char c; 
+	int uStringLen; 
+	unsigned char c; 
 	char *test_string; 
 
 	if (!pString)
@@ -651,7 +605,7 @@
 //----- (0044C51E) --------------------------------------------------------
 int GUIFont::GetLineWidth(const char *pString)
 	{
-	unsigned int str_len; // ebp@3
+	int str_len; // ebp@3
 	int string_line_width; // esi@3
 	unsigned char c;
 
@@ -703,7 +657,7 @@
 char * FitTextInAWindow( const char *pInString, GUIFont *pFont, GUIWindow *pWindow, signed int uX, int a5 )
     {
 	unsigned char c;
-	unsigned int uInStrLen;
+	int uInStrLen;
 	char digits[4];
 	int possible_transition_point;
 	int string_pixel_Width;
--- a/GUIFont.h	Sun Jun 02 22:16:58 2013 +0400
+++ b/GUIFont.h	Tue Jun 04 01:37:23 2013 +0400
@@ -20,26 +20,27 @@
   bool IsCharValid(unsigned 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);
+  int CalcTextHeight(const  char *pString, struct GUIWindow *pWindow, int uXOffset, int a5);
   int GetStringHeight2(GUIFont *a2, const char *Str, int a4, int a5, int a6);
-  int _44C6C2(const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5);
-  void _44D0B5(int a2, int a3, int a4, const char *pString, int a6);
-  void DrawTextLine(unsigned int uDefaultColor, signed int uX, signed int uY, const char *Str, int a6);
+  char* _44C6C2(const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5);
+  void DrawTextLineToBuff(int uColor, int a3, unsigned short* uX_buff_pos, const char *text, int line_width);
+  void DrawTextLine(unsigned int uDefaultColor, signed int uX, signed int uY, const char *text, int max_len_pix);
   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 * _44C933(const char *pString, GUIFont *pFont, GUIFont *a3, int a4, int a5, int a6);
 
-  unsigned char cFirstChar;
-  unsigned char cLastChar;
+  unsigned char cFirstChar;  //0
+  unsigned char cLastChar;  //1
   char field_2;
   char field_3;
   char field_4;
-  __int16 uFontHeight;
+  __int16 uFontHeight;  //5-6
   char field_7;
   int palletes_count;
   unsigned __int16 *pFontPalettes[5];
   GUICharMetric pMetrics[256];
-  int field_C20[256];
+  int font_pixels_offset[256];
+  unsigned char pFontData[0]; //array of font pixels
 };
 #pragma pack(pop)
 
--- a/GUIWindow.cpp	Sun Jun 02 22:16:58 2013 +0400
+++ b/GUIWindow.cpp	Tue Jun 04 01:37:23 2013 +0400
@@ -1379,7 +1379,7 @@
                 v28 = *((int *)&v10->cFirstChar + 3 * v15 + 9);
                 if ( v14 > 0 )
                   v12 += v10->pMetrics[v15].uLeftSpacing;
-                v17 = (int)((char *)&v10[1] + v10->field_C20[v15]);
+                v17 = (int)((char *)&v10[1] + v10->font_pixels_offset[v15]);
                 if ( (short)uFontColor )
                   pRenderer->DrawText(
                     v12,
@@ -1546,7 +1546,7 @@
                 v34 = *((int *)&pFont->cFirstChar + 3 * v16 + 9);
                 if ( (signed int)Str1b > 0 )
                   v13 += pFont->pMetrics[v16].uLeftSpacing;
-                v21 = (int)((char *)&pFont[1] + pFont->field_C20[v16]);
+                v21 = (int)((char *)&pFont[1] + pFont->font_pixels_offset[v16]);
                 if ( (short)uColor )
                   pRenderer->DrawText(v13, v14, (unsigned __int8 *)v21, v20, LOBYTE(pFont->uFontHeight), pFont->pFontPalettes[0], uColor, 0);
                 else
--- a/Player.h	Sun Jun 02 22:16:58 2013 +0400
+++ b/Player.h	Tue Jun 04 01:37:23 2013 +0400
@@ -201,7 +201,7 @@
 };
 
 /*  328 */
-enum PLAYER_SKILL_TYPE: __int8
+enum PLAYER_SKILL_TYPE: signed __int8
 {
   PLAYER_SKILL_STAFF = 0,
   PLAYER_SKILL_SWORD = 1,
@@ -591,31 +591,31 @@
   bool Recover(signed int a2);
   bool CanCastSpell(unsigned int uRequiredMana);
 
-  inline bool Weak()       {return pConditions[Condition::Condition_Weak] != 0;}
-  inline bool Dead()       {return pConditions[Condition::Condition_Dead] != 0;}
-  inline bool Eradicated() {return pConditions[Condition::Condition_Eradicated] != 0;}
-  inline bool Zombie()     {return pConditions[Condition::Condition_Zombie] != 0;}
-  inline bool Cursed()     {return pConditions[Condition::Condition_Cursed] != 0;}
-  inline bool Pertified()  {return pConditions[Condition::Condition_Pertified] != 0;}
+  inline bool Weak()       {return pConditions[Condition_Weak] != 0;}
+  inline bool Dead()       {return pConditions[Condition_Dead] != 0;}
+  inline bool Eradicated() {return pConditions[Condition_Eradicated] != 0;}
+  inline bool Zombie()     {return pConditions[Condition_Zombie] != 0;}
+  inline bool Cursed()     {return pConditions[Condition_Cursed] != 0;}
+  inline bool Pertified()  {return pConditions[Condition_Pertified] != 0;}
 
-  inline void SetCursed(bool state)      {pConditions[Condition::Condition_Cursed] = state;}
-  inline void SetWeak(bool state)        {pConditions[Condition::Condition_Weak] = state;}
-  inline void SetAsleep(bool state)      {pConditions[Condition::Condition_Sleep] = state;}
-  inline void SetAfraid(bool state)      {pConditions[Condition::Condition_Fear] = state;}
-  inline void SetDrunk(bool state)       {pConditions[Condition::Condition_Drunk] = state;}
-  inline void SetInsane(bool state)      {pConditions[Condition::Condition_Insane] = state;}
-  inline void SetPoison1(bool state)     {pConditions[Condition::Condition_Poison1] = state;}
-  inline void SetDisease1(bool state)    {pConditions[Condition::Condition_Disease1] = state;}
-  inline void SetPoison2(bool state)     {pConditions[Condition::Condition_Poison2] = state;}
-  inline void SetDisease2(bool state)    {pConditions[Condition::Condition_Disease2] = state;}
-  inline void SetPoison3(bool state)     {pConditions[Condition::Condition_Poison3] = state;}
-  inline void SetDisease3(bool state)    {pConditions[Condition::Condition_Disease3] = state;}
-  inline void SetParalyzed(bool state)   {pConditions[Condition::Condition_Paralyzed] = state;}
-  inline void SetUnconcious(bool state)  {pConditions[Condition::Condition_Unconcious] = state;}
-  inline void SetDead(bool state)        {pConditions[Condition::Condition_Dead] = state;}
-  inline void SetPertified(bool state)   {pConditions[Condition::Condition_Pertified] = state;}
-  inline void SetEradicated(bool state)  {pConditions[Condition::Condition_Eradicated] = state;}
-  inline void SetZombie(bool state)      {pConditions[Condition::Condition_Zombie] = state;}
+  inline void SetCursed(bool state)      {pConditions[Condition_Cursed] = state;}
+  inline void SetWeak(bool state)        {pConditions[Condition_Weak] = state;}
+  inline void SetAsleep(bool state)      {pConditions[Condition_Sleep] = state;}
+  inline void SetAfraid(bool state)      {pConditions[Condition_Fear] = state;}
+  inline void SetDrunk(bool state)       {pConditions[Condition_Drunk] = state;}
+  inline void SetInsane(bool state)      {pConditions[Condition_Insane] = state;}
+  inline void SetPoison1(bool state)     {pConditions[Condition_Poison1] = state;}
+  inline void SetDisease1(bool state)    {pConditions[Condition_Disease1] = state;}
+  inline void SetPoison2(bool state)     {pConditions[Condition_Poison2] = state;}
+  inline void SetDisease2(bool state)    {pConditions[Condition_Disease2] = state;}
+  inline void SetPoison3(bool state)     {pConditions[Condition_Poison3] = state;}
+  inline void SetDisease3(bool state)    {pConditions[Condition_Disease3] = state;}
+  inline void SetParalyzed(bool state)   {pConditions[Condition_Paralyzed] = state;}
+  inline void SetUnconcious(bool state)  {pConditions[Condition_Unconcious] = state;}
+  inline void SetDead(bool state)        {pConditions[Condition_Dead] = state;}
+  inline void SetPertified(bool state)   {pConditions[Condition_Pertified] = state;}
+  inline void SetEradicated(bool state)  {pConditions[Condition_Eradicated] = state;}
+  inline void SetZombie(bool state)      {pConditions[Condition_Zombie] = state;}
 
 
 
--- a/UIBooks.cpp	Sun Jun 02 22:16:58 2013 +0400
+++ b/UIBooks.cpp	Tue Jun 04 01:37:23 2013 +0400
@@ -478,7 +478,7 @@
   int v6; // eax@21
   int v7; // esi@21
   char *v8; // eax@21
-  int v9; // eax@22
+  char* v9; // eax@22
   unsigned int v11; // [sp-8h] [bp-64h]@3
   unsigned int v12; // [sp-8h] [bp-64h]@7
   Texture *v13; // [sp-4h] [bp-60h]@3
--- a/UIHouses.h	Sun Jun 02 22:16:58 2013 +0400
+++ b/UIHouses.h	Tue Jun 04 01:37:23 2013 +0400
@@ -1,6 +1,6 @@
 #pragma once
 
-enum HOUSE_DIALOGUE_MENU: unsigned __int32
+enum HOUSE_DIALOGUE_MENU: __int32
 {
   HOUSE_DIALOGUE_NULL = 0,
   HOUSE_DIALOGUE_MAIN = 1,
--- a/mm7_3.cpp	Sun Jun 02 22:16:58 2013 +0400
+++ b/mm7_3.cpp	Tue Jun 04 01:37:23 2013 +0400
@@ -13893,8 +13893,8 @@
 }
 
 //----- (0044C175) --------------------------------------------------------
-void __fastcall ShowStatusBarString(const char *pString, unsigned int uNumSeconds)
-{
+void ShowStatusBarString( const char *pString, unsigned int uNumSeconds )
+    {
   unsigned int v2; // esi@1
   int i; // eax@1
 
--- a/mm7_5.cpp	Sun Jun 02 22:16:58 2013 +0400
+++ b/mm7_5.cpp	Tue Jun 04 01:37:23 2013 +0400
@@ -9308,45 +9308,7 @@
   ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue);
 }
 
-//----- (0040F845) --------------------------------------------------------
-__int16 __fastcall sub_40F845(int a1, int a2, int a3, int a4, int a5, __int16 a6, int a7)
-{
-  int v7; // edi@1
-  int v8; // esi@1
-  int v9; // ecx@2
-  int v10; // eax@3
-
-  v7 = a1;
-  v8 = a2;
-  do
-  {
-    v9 = a3;
-    do
-    {
-      v10 = *(char *)v8++;
-      if ( (char)v10 )
-      {
-        if ( (char)v10 == 1 )
-        {
-          LOWORD(v10) = *(short *)(a5 + 2 * v10);
-          *(short *)v7 = v10;
-        }
-        else
-        {
-          LOWORD(v10) = a6;
-          *(short *)v7 = a6;
-        }
-      }
-      v7 += 2;
-      --v9;
-    }
-    while ( v9 );
-    v7 = a7 + v7 - a3 - a3;
-    --a4;
-  }
-  while ( a4 );
-  return v10;
-}
+
 
 //----- (0040F89C) --------------------------------------------------------
 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue)
--- a/mm7_6.cpp	Sun Jun 02 22:16:58 2013 +0400
+++ b/mm7_6.cpp	Tue Jun 04 01:37:23 2013 +0400
@@ -2599,7 +2599,7 @@
   AwardType *v607; // ecx@1100
   __int16 v608; // ax@1102
   signed int v609; // eax@1104
-  //int v610; // edi@1106
+  int v610; // edi@1106
   unsigned int v611; // eax@1106
   Player *v612; // edi@1106
   DDM_DLV_Header *v613; // eax@1108
@@ -6207,8 +6207,7 @@
 			}
 			v608 = pCastSpell->uPlayerID_2;
 			if ( v608 != 4 && v608 != 5
-				//|| (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0)
-				|| (v609 = achieved_awards[v608 + (unsigned __int8)pParty->field_709 - 4], v609 <= 0)
+				|| (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0)
 				|| v609 >= 3 )
 			{
 				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
@@ -6216,7 +6215,7 @@
 				pCastSpell->spellnum = 0;
 				continue;
 			}
-			//v610 = 76 * v609;
+			v610 = 76 * v609;
 			//*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0;
 			pParty->pHirelings[v609-1].evt_B = 0;
 			v611 = pIconsFrameTable->FindIcon("spell96");
--- a/mm7_data.cpp	Sun Jun 02 22:16:58 2013 +0400
+++ b/mm7_data.cpp	Tue Jun 04 01:37:23 2013 +0400
@@ -1166,7 +1166,7 @@
 char pFinalMessage[4096]; // idb
 char pTmpBuf[2000];
 char pTmpBuf2[2000];
-char byte_5C6D50[777]; // weak
+char byte_5C6D50[100]; // weak
 int ui_current_text_color; // weak
 __int64 qword_5C6DF0; // weak
 int dword_5C6DF8; // weak
--- a/mm7_data.h	Sun Jun 02 22:16:58 2013 +0400
+++ b/mm7_data.h	Tue Jun 04 01:37:23 2013 +0400
@@ -1206,7 +1206,7 @@
 int __stdcall retzero_sub_40DFA7(int); // weak
 int loc_40E4FC(); // weak
 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue);
-__int16 __fastcall sub_40F845(int a1, int a2, int a3, int a4, int a5, __int16 a6, int a7);
+
 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue);
 void __fastcall sub_40F92A(int *pZBuffer, struct Texture *a2, int a3); // idb
 void __cdecl SetMoonPhaseNames();
@@ -1364,7 +1364,7 @@
 __int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2); // idb
 bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2);
 void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle); // idb
-void __fastcall ShowStatusBarString(const char *pString, unsigned int uNumSeconds);
+void ShowStatusBarString(const char *pString, unsigned int uNumSeconds);
 void __cdecl ShowNothingHereStatus();
 signed int __cdecl const_2();
 bool __cdecl sub_44C28F_open_nwc_dungeon();