changeset 1180:b542660e7302

Слияние
author Ritor1
date Wed, 05 Jun 2013 17:40:17 +0600
parents 883eaee77094 (current diff) 8b3e7d5ba069 (diff)
children 64cda98b739c 02e2a5c1ebc0
files
diffstat 13 files changed, 290 insertions(+), 390 deletions(-) [+]
line wrap: on
line diff
--- a/GUIFont.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/GUIFont.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -64,74 +64,58 @@
 
 
 //----- (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)
-{
-  int v11; // ebx@1
-  int v12; // edi@1
-  char *v13; // eax@1
-  char *v14; // eax@1
-  unsigned __int16 *v15; // esi@1
-  GUIFont *v16; // edi@4
-  signed int v17; // ecx@4
-  signed int v18; // eax@6
-  int v19; // [sp+Ch] [bp-5Ch]@1
-  int v20; // [sp+10h] [bp-58h]@1
-  unsigned int v21; // [sp+14h] [bp-54h]@1
-  unsigned int v22; // [sp+18h] [bp-50h]@1
-  unsigned int v23; // [sp+1Ch] [bp-4Ch]@1
-  unsigned int v24; // [sp+20h] [bp-48h]@1
-  GUIFont *v25; // [sp+60h] [bp-8h]@1
-  GUIFont *v26; // [sp+64h] [bp-4h]@1
-  char *Stra; // [sp+70h] [bp+8h]@1
-  int a4a; // [sp+74h] [bp+Ch]@4
-  int a7a; // [sp+80h] [bp+18h]@2
+void GUIFont::_44D2FD_prolly_draw_credits_entry( GUIFont *pSecondFont, int uFrameX, int uFrameY, unsigned int w, unsigned int h, 
+                                                 unsigned __int16 firstColor, unsigned __int16 secondColor, const char *pString, 
+                                                 unsigned __int16 *pPixels, unsigned int uPixelsWidth )
+    {
+  char *work_string; // eax@1
+  unsigned __int16 *curr_pixel_pos; // esi@1
+  GUIFont *currentFont; // edi@4
+  signed int start_str_pos; // ecx@4
+  signed int line_w; // eax@6
+  GUIWindow draw_window; // [sp+Ch] [bp-5Ch]@
+  int currentColor; // [sp+74h] [bp+Ch]@4
+  int half_frameX; // [sp+80h] [bp+18h]@2
 
-  v11 = a7;
-  v22 = h;
-  v12 = Str;
-  v26 = this;
-  v24 = a4 + h - 1;
-  v21 = w;
-  v25 = pFont;
-  v23 = Str + w - 1;
-  ui_current_text_color = a7;
-  v19 = Str;
-  v20 = a4;
-  v13 = GUIFont::_44C933(pString, this, pFont, (int)&v19, 0, 1);
-  v14 = strtok(v13, "\n");
-  Stra = v14;
-  v15 = &pPixels[uPixelsWidth * a4];
-  if ( v14 )
+  draw_window.uFrameHeight = h;
+  draw_window.uFrameW = uFrameY + h - 1;
+  draw_window.uFrameWidth = w;
+  draw_window.uFrameZ = uFrameX + w - 1;
+  ui_current_text_color = firstColor;
+  draw_window.uFrameX = uFrameX;
+  draw_window.uFrameY = uFrameY;
+
+  work_string = GUIFont::FitTwoFontStringINWindow(pString, this, pSecondFont, &draw_window, 0, 1);
+  work_string = strtok(work_string, "\n");
+  curr_pixel_pos = &pPixels[uPixelsWidth * uFrameY];
+  if ( work_string )
   {
-    a7a = v12 >> 1;
+    half_frameX = uFrameX >> 1;
     while ( 1 )
     {
-      v16 = v26;
-      ui_current_text_color = v11;
-      v17 = 0;
-      a4a = v11;
-      if ( *v14 == '_' )
+      currentFont = this;
+      ui_current_text_color = firstColor;
+      start_str_pos = 0;
+      currentColor = firstColor;
+      if ( *work_string == '_' )
       {
-        v16 = v25;
-        a4a = a8;
-        ui_current_text_color = a8;
-        v17 = 1;
+        currentFont = pSecondFont;
+        currentColor = secondColor;
+        ui_current_text_color = secondColor;
+        start_str_pos = 1;
       }
-      v18 = (signed int)(w - v16->GetLineWidth(&v14[v17])) >> 1;
-      if ( v18 < 0 )
-        v18 = 0;
-      v16->DrawTextLineToBuff(a4a, a8, &v15[v18 + a7a], Stra, uPixelsWidth);
-      v15 += uPixelsWidth * (LOBYTE(v16->uFontHeight) - 3);
-      Stra = strtok(0, "\n");
-      if ( !Stra )
+      line_w = (signed int)(w - currentFont->GetLineWidth(&work_string[start_str_pos]))/2;
+      if ( line_w < 0 )
+        line_w = 0;
+      currentFont->DrawTextLineToBuff(currentColor, secondColor, &curr_pixel_pos[line_w + half_frameX], work_string, uPixelsWidth);
+      curr_pixel_pos += uPixelsWidth * (currentFont->uFontHeight - 3);
+      work_string = strtok(0, "\n");
+      if ( !work_string )
         break;
-      v14 = Stra;
     }
   }
 }
-// 5C6DB4: using guessed type int ui_current_text_color;
+
 
 
 //----- (0044D1E7) --------------------------------------------------------
@@ -258,7 +242,7 @@
               i += 5;	  
               break;
           case '\t':	// Horizontal tab 09
-          case '\r':   //Carriage Return 0D 13                 
+          case '_':                   
               break;
           default:
               uCharWidth = pMetrics[c].uWidth;
@@ -283,192 +267,120 @@
 
 
 //----- (0044C933) --------------------------------------------------------
-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
-  size_t v9; // edi@3
-  int v10; // eax@3
-  GUIFont *v11; // esi@3
-  int v12; // ebx@3
-  char v13; // cl@5
-  int v14; // edx@11
-  int v15; // ecx@11
-  int v16; // edx@12
-  int v17; // edx@13
-  int v18; // edx@14
-  int v19; // edx@15
-  int v20; // edi@17
-  int v21; // edx@17
-  int v22; // ecx@17
-  int v23; // edi@18
-  char v24; // zf@18
-  int v25; // ecx@19
-  int v26; // eax@19
-  char v27; // dl@24
-  int v28; // eax@46
-  std::string v29; // [sp-18h] [bp-48h]@2
-  const char *v30; // [sp-8h] [bp-38h]@2
-  int v31; // [sp-4h] [bp-34h]@2
-  const char *v32; // [sp+Ch] [bp-24h]@1
-  char Str; // [sp+10h] [bp-20h]@46
-  char v34; // [sp+13h] [bp-1Dh]@46
-  GUIFont *v35; // [sp+14h] [bp-1Ch]@1
-  int v36; // [sp+18h] [bp-18h]@3
-  int v37; // [sp+1Ch] [bp-14h]@3
-  int v38; // [sp+20h] [bp-10h]@4
-  int v39; // [sp+24h] [bp-Ch]@3
-  int v40; // [sp+28h] [bp-8h]@3
-  int i; // [sp+2Ch] [bp-4h]@17
-  std::string *v42; // [sp+38h] [bp+8h]@2
+char * GUIFont::FitTwoFontStringINWindow( const char *pString, GUIFont *pFontMain, GUIFont *pFontSecond, GUIWindow* pWindow, int startPixlOff, int a6 )
+    {
+ 
+  GUIFont *currentFont; // esi@3
+  unsigned char c;
+  int uInStrLen;
+  char digits[4];
+  int possible_transition_point;
+  int string_pixel_Width;
+  int start_pixel_offset;
+
+  if (!pString)
+      {
+      MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:445", 0);
+      return 0;
+      }
+  currentFont=pFontMain; // esi@3
+  uInStrLen = strlen(pString);
+  assert(uInStrLen < sizeof(pTmpBuf3));
+  strcpy(pTmpBuf3, pString);
+  if (uInStrLen==0)
+      return pTmpBuf3;
 
-  v6 = pString;
-  v35 = pFont;
-  v32 = pString;
-  if ( !pString )
-  {
-    MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:558", 0);
-    return 0;
-  }
-  v8 = strlen(pString);
-  v9 = v8;
-  v39 = v8;
+  start_pixel_offset=string_pixel_Width=startPixlOff;
+  possible_transition_point=0;
+  for(int i=0; i<uInStrLen; ++i) 
+      {
+      c=pTmpBuf3[i];
+      if (pFontMain->IsCharValid(c))
+          {
+          switch (c)
+              {
+          case '\t':	// Horizontal tab 09
+              {
+              strncpy(digits, &pTmpBuf3[i+1],3);
+              digits[3]=0;
+              string_pixel_Width = atoi(digits)+startPixlOff;
+              i+=3;
+              break;
+              }
+          case  '\n':	//Line Feed 0A 10
+              {
+              string_pixel_Width=start_pixel_offset;
+              possible_transition_point=i;
+              currentFont=pFontMain;
+              break;
+              }
+          case  '\f':   //Form Feed, page eject  0C 12
+              {
+              i+=5;  
+              break;
+              }
+          case  '\r':   //Carriage Return 0D 13
+              {
+              if (!a6)
+                  return (char*)pString;
+              break;
+              }
+          case ' ' :
+              {
+              string_pixel_Width+=currentFont->pMetrics[c].uWidth;
+              possible_transition_point=i;
+              break;
+              }
+          case '_' :
+              currentFont=pFontSecond;
+              break;
+          default:
 
-  assert(strlen(v6) < sizeof(pTmpBuf3));
-  strcpy(pTmpBuf3, v6);
-  v10 = a5;
-  v11 = v35;
-  v12 = 0;
-  v40 = 0;
-  v37 = a5;
-  v36 = 0;
-  if ( (signed int)v9 > 0 )
-  {
-    v38 = v9 - 1;
-    do
-    {
-      v13 = pTmpBuf3[v12];
-      if ( (unsigned __int8)v13 >= v11->cFirstChar && (unsigned __int8)v13 <= v11->cLastChar
-        || v13 == '\f'
-        || v13 == '\r'
-        || v13 == '\t'
-        || v13 == '\n' )
-      {
-        v14 = (unsigned __int8)v13 - 9;
-        v15 = (int)&v11->pMetrics[(unsigned __int8)v13];
-        if ( v14 )
-        {
-          v16 = v14 - 1;
-          if ( v16 )
-          {
-            v17 = v16 - 2;
-            if ( v17 )
-            {
-              v18 = v17 - 1;
-              if ( v18 )
-              {
-                v19 = v18 - 19;
-                if ( v19 )
-                {
-                  if ( v19 == 63 )
-                  {
-                    v11 = a3;
-                  }
-                  else
+              if ((string_pixel_Width+currentFont->pMetrics[c].uWidth+ currentFont->pMetrics[c].uLeftSpacing+
+                  currentFont->pMetrics[c].uRightSpacing)<pWindow->uFrameWidth)
                   {
-                    v20 = *(int *)(v15 + 8);
-                    v21 = *(int *)(v15 + 4);
-                    v22 = *(int *)v15;
-                    i = v20;
-                    if ( (unsigned int)(v10 + v20 + v22 + v21) < *(int *)(a4 + 8) )
-                    {
-                      v12 = v36;
-                      if ( v36 > v40 )
-                        v10 += v22;
-                      v10 += v21;
-                      if ( v36 < v39 )
-                        v10 += i;
-                    }
-                    else
-                    {
-                      v23 = v40;
-                      v24 = v11 == a3;
-                      pTmpBuf3[v40] = 10;
-                      if ( v24 )
-                      {
-                        v25 = v38;
-                        v26 = v23 + 1;
-                        while ( v25 >= v26 )
-                        {
-                          pTmpBuf3[v25] = byte_5C45AF[v25];
-                          --v25;
-                        }
-                        ++v39;
-                        ++v38;
-                        pTmpBuf3[v23++ + 1] = 95;
-                        v40 = v26;
-                      }
-                      v12 = v36;
-                      v10 = v37;
-                      for ( i = v23; i <= v36; ++i )
+                  if(i>possible_transition_point)
+                      string_pixel_Width+=currentFont->pMetrics[c].uLeftSpacing;
+                  string_pixel_Width+=currentFont->pMetrics[c].uWidth;
+                  if (i<uInStrLen)
+                      string_pixel_Width+=currentFont->pMetrics[c].uRightSpacing;
+                  }
+              else
+                  {
+                  pTmpBuf3[possible_transition_point]='\n';
+                      
+                  if ( currentFont== pFontSecond)
                       {
-                        v27 = pTmpBuf3[i];
-                        if ( (unsigned __int8)v27 >= v11->cFirstChar && (unsigned __int8)v27 <= v11->cLastChar
-                          || v27 == 12
-                          || v27 == 13
-                          || v27 == 9
-                          || v27 == 10 )
-                        {
-                          if ( i > v23 )
-                            v10 += v11->pMetrics[(unsigned __int8)v27].uLeftSpacing;
-                          v10 += *((int *)&v11->cFirstChar + 3 * (unsigned __int8)v27 + 9);
-                          if ( i < v36 )
-                            v10 += v11->pMetrics[(unsigned __int8)v27].uRightSpacing;
-                        }
+
+                      for(int k=uInStrLen-1; k>=possible_transition_point+1; --k)
+                          pTmpBuf3[k] = pTmpBuf3[k-1];
+
+                      ++uInStrLen;
+                      ++possible_transition_point;
+                      pTmpBuf3[possible_transition_point] = '_';
+                      
                       }
-                    }
+                     string_pixel_Width=start_pixel_offset;
+
+                      for(int j=possible_transition_point;j<i; ++j ) 
+                          {
+                          c=pTmpBuf3[j];
+                          if (pFontMain->IsCharValid(c))
+                              {
+                              if(j>possible_transition_point)
+                                  string_pixel_Width+=pFontMain->pMetrics[c].uLeftSpacing;
+                              string_pixel_Width+=pFontMain->pMetrics[c].uWidth;
+                              if (j<i)
+                                  string_pixel_Width+=pFontMain->pMetrics[c].uRightSpacing;
+
+                              }
+                          }                    
                   }
-                }
-                else
-                {
-                  v10 += *(int *)(v15 + 4);
-                  v40 = v12;
-                }
-              }
-              else
-              {
-                if ( !a6 )
-                  return (char *)v32;
               }
-            }
-            else
-            {
-              v12 += 5;
-            }
           }
-          else
-          {
-            v10 = v37;
-            v11 = v35;
-            v40 = v12;
-          }
-        }
-        else
-        {
-          strncpy(&Str, &pTmpBuf3[v12 + 1], 3u);
-          v34 = 0;
-          v28 = atoi(&Str);
-          v10 = a5 + v28;
-          v12 += 3;
-          v37 = v10;
-        }
       }
-      ++v12;
-      v36 = v12;
-    }
-    while ( v12 < v39 );
-  }
   return pTmpBuf3;
+
 }
 
 
@@ -487,7 +399,6 @@
     return 0;
   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];
@@ -509,7 +420,7 @@
               break;    
               }
           if ( text_height >= (signed int)(a5 * pWindow->uFrameHeight) )
-              return &text_str[i];
+              break;
           }
       }
   return &text_str[i];
@@ -518,54 +429,42 @@
 
 
 //----- (0044C62E) --------------------------------------------------------
-int GUIFont::GetStringHeight2(GUIFont *a2, const char *Str, int a4, int a5, int a6)
-{
-  GUIFont *v6; // edi@1
-  int v8; // esi@3
-  unsigned __int8 *v9; // ebx@3
-  size_t v10; // eax@3
-  unsigned __int8 v11; // cl@4
-  signed int Stra; // [sp+Ch] [bp+8h]@3
-  size_t v13; // [sp+14h] [bp+10h]@3
-
-  auto a1 = this;
-  v6 = a1;
-  if ( !Str )
-    return 0;
-  v8 = LOBYTE(a1->uFontHeight) - 3;
-  v9 = (unsigned __int8 *)GUIFont::_44C933(Str, a1, a2, a4, a5, 0);
-  v10 = strlen(Str);
-  Stra = 0;
-  v13 = v10;
-  while ( Stra < (signed int)v13 )
-  {
-    if ( GUIFont::IsCharValid(v11 = *v9) )
+int GUIFont::GetStringHeight2( GUIFont *secondFont, const char *text_str, GUIWindow* pWindow, int startX, int a6 )
     {
-      if ( v11 == 9 )
-        goto LABEL_9;
-      switch ( v11 )
+ 
+  int uAllHeght; 
+  int uStringLen; 
+  unsigned char c; 
+  char *test_string; 
+
+  if ( !text_str )
+    return 0;
+  uAllHeght = uFontHeight - 3;
+  test_string = FitTwoFontStringINWindow(text_str, this, secondFont, pWindow, startX, 0);
+  uStringLen = strlen(test_string);
+  for (int i = 0; i < uStringLen; ++i)
       {
-        case 0xAu:
-          v8 = v8 + LOBYTE(v6->uFontHeight) - 3;
-          break;
-        case 0xCu:
-          v9 += 5;
-          Stra += 5;
-          break;
-        case 0xDu:
-LABEL_9:
-          if ( a6 != 1 )
+      c = test_string[i];
+      if (IsCharValid(c))
           {
-            v9 += 3;
-            Stra += 3;
+          switch (c)
+              {
+          case '\n':	//Line Feed 0A 10:
+              uAllHeght+= 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 (a6 != 1)
+                  i += 3;
+              break;
+              }
           }
-          break;
       }
-    }
-    ++Stra;
-    ++v9;
-  }
-  return v8;
+
+  return uAllHeght;
 }
 
 //----- (0044C59D) --------------------------------------------------------
@@ -578,7 +477,7 @@
 
 	if (!pString)
 		return 0;
-	uAllHeght = this->uFontHeight - 3;
+	uAllHeght = uFontHeight - 3;
 	test_string = FitTextInAWindow(pString, this, pWindow, uXOffset, 0);
 	uStringLen = strlen(pString);
 	for (int i = 0; i < uStringLen; ++i)
@@ -589,7 +488,7 @@
 			switch (c)
 				{
 			case '\n':	//Line Feed 0A 10:
-				uAllHeght+= this->uFontHeight - 3;
+				uAllHeght+= uFontHeight - 3;
 				break;
 			case '\f':  //Form Feed, page eject  0C 12 
 				i += 5;		  
@@ -633,10 +532,10 @@
 				break;
 			default:
 				if (i > 0)
-					string_line_width += this->pMetrics[c].uLeftSpacing;
-				string_line_width += this->pMetrics[c].uWidth;
+					string_line_width += pMetrics[c].uLeftSpacing;
+				string_line_width += pMetrics[c].uWidth;
 				if (i < str_len)
-					string_line_width +=this->pMetrics[c].uRightSpacing;
+					string_line_width +=pMetrics[c].uRightSpacing;
 				}
 			}
 		}
--- a/GUIFont.h	Wed Jun 05 17:40:09 2013 +0600
+++ b/GUIFont.h	Wed Jun 05 17:40:17 2013 +0600
@@ -21,13 +21,15 @@
   int AlignText_Center(unsigned int uCenterX, const char *pString);
   int GetLineWidth(const char *pString);
   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 GetStringHeight2(GUIFont *secondFont, const char *text_str, GUIWindow* pWindow, int startX, 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);
+  void _44D2FD_prolly_draw_credits_entry(GUIFont *pSecondFont, int uFrameX, int uFrameY, unsigned int w, unsigned int h, 
+                                        unsigned __int16 firstColor, unsigned __int16 secondColor, 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);
+  static char * FitTwoFontStringINWindow(const char *pString, GUIFont *pFontMain, GUIFont *pFontSecond, GUIWindow* pWindow, int startPixlOff, int a6);
 
   unsigned char cFirstChar;  //0
   unsigned char cLastChar;  //1
--- a/Indoor.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/Indoor.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -4194,14 +4194,14 @@
               }
               if ( v0->GetActorsRelation(0) )
               {
-                v51 = __OFSUB__(HIDWORD(pParty->pPartyBuffs[11].uExpireTime), v22);
-                v49 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == v22;
-                v50 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) - v22 < 0;
+                v51 = __OFSUB__(HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime), v22);
+                v49 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) == v22;
+                v50 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) - v22 < 0;
                 v0->vVelocity.y = v22;
                 v0->vVelocity.x = v22;
                 if ( !(v50 ^ v51)
-                  && (!((unsigned __int8)(v50 ^ v51) | v49) || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > v22) )
-                  pParty->pPartyBuffs[11].Reset();
+                  && (!((unsigned __int8)(v50 ^ v51) | v49) || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > v22) )
+                  pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
                 viewparams->bRedrawGameUI = 1;
                 goto LABEL_119;
               }
--- a/Party.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/Party.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -842,8 +842,8 @@
   int v3; // eax@9
   unsigned int v4; // [sp+8h] [bp-4h]@4
 
-  if ( (signed __int64)pParty->pPartyBuffs[11].uExpireTime > 0 )
-    pParty->pPartyBuffs[11].Reset();
+  if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0 )
+    pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
   if ( pParty->bTurnBasedModeOn != 1 )
   {
     v4 = 0;
--- a/Player.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/Player.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -1079,10 +1079,10 @@
         PlaySound((PlayerSpeech)30, 0);
         break;
     case Condition_Weak:
-        if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 )
-            {--pParty->pPartyBuffs[13].uPower;
-        if ( pParty->pPartyBuffs[13].uPower < 1u )
-            pParty->pPartyBuffs[13].Reset();
+        if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 )
+            {--pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
+        if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
+            pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
         return 0;
             }
 
@@ -1115,11 +1115,11 @@
     case Condition_Poison3:
         if ( a3 == 1 )
             {
-            if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 )
+            if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 )
                 {
-                --pParty->pPartyBuffs[13].uPower;
-                if ( pParty->pPartyBuffs[13].uPower < 1u )
-                    pParty->pPartyBuffs[13].Reset();
+                --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
+                if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
+                    pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
                 }
             if ( HasEnchantedItemEquipped(21)
                 || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)
@@ -1137,11 +1137,11 @@
     case Condition_Disease3:
         if ( a3 == 1 )
             {            
-            if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 )
+            if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 )
                 {
-                --pParty->pPartyBuffs[13].uPower;
-                if ( pParty->pPartyBuffs[13].uPower < 1u )
-                    pParty->pPartyBuffs[13].Reset();
+                --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
+                if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
+                    pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
                 return 0;
                 }
 
@@ -1155,11 +1155,11 @@
     case Condition_Paralyzed:
         if ( a3 == 1 )
             {
-            if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 )
+            if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 )
                 {
-                --pParty->pPartyBuffs[13].uPower;
-                if ( pParty->pPartyBuffs[13].uPower < 1u )
-                    pParty->pPartyBuffs[13].Reset();
+                --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
+                if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
+                    pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
                 return 0;
                 }
 
@@ -1176,11 +1176,11 @@
             sHealth = 0;
         break;
     case Condition_Dead:
-        if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 && pParty->pPartyBuffs[13].uSkill >= 4u )
+        if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u )
             {
-            --pParty->pPartyBuffs[13].uPower;
-            if ( pParty->pPartyBuffs[13].uPower < 1u )
-                pParty->pPartyBuffs[13].Reset();
+            --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
+            if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
+                pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
             }
 
         PlaySound((PlayerSpeech)33, 0);
@@ -1191,7 +1191,7 @@
         break;
     case Condition_Pertified:
         if ( a3 == 1
-            &&((pParty->pPartyBuffs[13].uExpireTime > 0i64)
+            &&((pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64)
             || HasEnchantedItemEquipped(23)|| 
             WearsItem(ITEM_RELIC_KELEBRIM, EQIUP_ANY) || 
             WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || 
@@ -1201,11 +1201,11 @@
         PlaySound((PlayerSpeech)34, 0);
         break;
     case Condition_Eradicated:
-        if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 )&&( pParty->pPartyBuffs[13].uSkill >= 4u ))
+        if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 )&&( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u ))
             {
-            --pParty->pPartyBuffs[13].uPower;
-            if ( pParty->pPartyBuffs[13].uPower < 1u )
-                pParty->pPartyBuffs[13].Reset();
+            --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
+            if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
+                pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
             return 0;
             }
         PlaySound(SPEECH_35, 0);
@@ -5337,25 +5337,25 @@
       {
         case CHARACTER_ATTRIBUTE_RESIST_BODY:
           v3 = this->pPlayerBuffs[2].uPower;
-          v4 = pParty->pPartyBuffs[1].uPower;
+          v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower;
           break;
         case CHARACTER_ATTRIBUTE_RESIST_AIR:
           v3 = this->pPlayerBuffs[0].uPower;
-          v4 = pParty->pPartyBuffs[0].uPower;
+          v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower;
           break;
         case CHARACTER_ATTRIBUTE_RESIST_WATER:
           v3 = this->pPlayerBuffs[22].uPower;
-          v4 = pParty->pPartyBuffs[17].uPower;
+          v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower;
           break;
         case CHARACTER_ATTRIBUTE_RESIST_EARTH:
           v3 = this->pPlayerBuffs[3].uPower;
-          v4 = pParty->pPartyBuffs[4].uPower;
+          v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower;
           break;
         default:
           if ( a2 != 14 )
             return result;
           v3 = this->pPlayerBuffs[9].uPower;
-          v4 = pParty->pPartyBuffs[12].uPower;
+          v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower;
           break;
       }
       return v4 + v3;
@@ -5365,7 +5365,7 @@
       if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS )
       {
         v3 = this->pPlayerBuffs[8].uPower;
-        v4 = pParty->pPartyBuffs[9].uPower;
+        v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower;
         return v4 + v3;
       }
       if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK )
@@ -5376,7 +5376,7 @@
   if ( a2 == 10 )
   {
     v3 = this->pPlayerBuffs[5].uPower;
-    v4 = pParty->pPartyBuffs[6].uPower;
+    v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower;
     return v4 + v3;
   }
   switch ( a2 )
@@ -5402,11 +5402,11 @@
     case CHARACTER_ATTRIBUTE_LUCK:
       v3 = pPlayerBuffs[18].uPower;
 LABEL_5:
-      v4 = pParty->pPartyBuffs[2].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
       return v4 + v3;
     case CHARACTER_ATTRIBUTE_AC_BONUS:
       v3 = this->pPlayerBuffs[14].uPower;
-      v4 = pParty->pPartyBuffs[15].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower;
       return v4 + v3;
     default:
       return result;
@@ -7406,7 +7406,7 @@
     switch ( VarNum )
     {
       case VAR_Invisible:
-        if ( pParty->pPartyBuffs[11].uExpireTime >0 )
+        if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 )
           return true;
         return false;
       case VAR_NumDeaths:
@@ -7495,7 +7495,7 @@
         return v6;
       case VAR_IsFlying:
         if ( pParty->bFlying
-          && (pParty->pPartyBuffs[7].uExpireTime> 0) )
+          && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) )
           return true;
         return false;
       case VAR_HiredNPCHasSpeciality:
--- a/UIMainMenu.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/UIMainMenu.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -280,10 +280,7 @@
         unsigned int v10; // ST2C_4@19
         MSG Msg; // [sp+84h] [bp-B8h]@10
         int v17; // [sp+A0h] [bp-9Ch]@9
-        int pX; // [sp+A4h] [bp-98h]@9
-        unsigned int pY; // [sp+A8h] [bp-94h]@9
-        int v20; // [sp+ACh] [bp-90h]@9
-        int a4; // [sp+B0h] [bp-8Ch]@9
+        GUIWindow a2;
         int pColor2; // [sp+F8h] [bp-44h]@9
         int pColor1; // [sp+FCh] [bp-40h]@9
         int a5; // [sp+128h] [bp-14h]@1
@@ -321,13 +318,15 @@
         pFont = pFontCChar;
         pFont2 = pFontQuick;
         v1[pSize] = 0;
-        v20 = 250;
-        a4 = 440;
-        pX = 389;
-        pY = 19;
+        
+        a2.uFrameWidth = 250;
+        a2.uFrameHeight = 440;
+        a2.uFrameX = 389;
+        a2.uFrameY = 19;
+
         pTexture2.uWidth = 250;
-        pHeight = pFont2->GetStringHeight2(pFont, v1, (int)&pX, 0, 1);
-        pTexture2.uHeight = pHeight + 2 * a4;
+        pHeight = pFont2->GetStringHeight2(pFont, v1, &a2, 0, 1);
+        pTexture2.uHeight = pHeight + 2 * a2.uFrameHeight;
         pTexture2.uNumPixels = (signed __int16)pTexture2.uWidth * (signed __int16)pTexture2.uHeight;
         v7 = pAllocator->AllocNamedChunk(pTexture2.pPixels, 2 * pTexture2.uNumPixels, "scrollermap");
         pNumPixels = pTexture2.uNumPixels;
@@ -341,7 +340,7 @@
         pString = (char *)operator new(2 * pSize);
         strncpy(pString, ptr, pSize);
         pString[pSize]=0;
-        pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, a4, (signed __int16)pTexture2.uWidth, (signed __int16)pTexture2.uHeight, pColor1, 
+        pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, a2.uFrameHeight, (signed __int16)pTexture2.uWidth, (signed __int16)pTexture2.uHeight, pColor1, 
             pColor2, pString, pTexture2.pPixels, (signed __int16)pTexture2.uWidth);
         free(pString);
         pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, (int)ptr);
@@ -365,8 +364,8 @@
                 {
                 pRenderer->BeginScene();
                 pRenderer->DrawTextureRGB(0, 0, &pTexture);
-                pRenderer->SetTextureClipRect(pX, pY, pX + v20, pY + a4);
-                pRenderer->_4A5D33(pX, pY, 0, a5, &pTexture2);
+                pRenderer->SetTextureClipRect(a2.uFrameX, a2.uFrameY, a2.uFrameX + a2.uFrameWidth, a2.uFrameY + a2.uFrameHeight);
+                pRenderer->_4A5D33(a2.uFrameX, a2.uFrameY, 0, a5, &pTexture2);
                 pRenderer->ResetTextureClipRect();
                 pRenderer->EndScene();
                 ++a5;
--- a/UIPartyCreation.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/UIPartyCreation.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -905,8 +905,8 @@
 
       for (uint k = 0; k < 138; k++)
       {
-        if (player->pInventoryItems[k].uItemID)
-          player->pInventoryItems[k].SetIdentified();
+        if (player->pOwnItems[k].uItemID)
+          player->pOwnItems[k].SetIdentified();
       }
     }
   }
--- a/UIPopup.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/UIPopup.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -1393,7 +1393,7 @@
     }
     while ( i < 10 );
   }
-  if ( (signed __int64)pParty->pPartyBuffs[3].uExpireTime > 0 )
+  if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 )
   {
     sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[650], v121->sCurrentHP);
     pFontSmallnum->GetLineWidth(pTmpBuf);
--- a/UiGame.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/UiGame.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -2247,7 +2247,7 @@
             pFace = pTexture_PlayerFaceEradicated;
             pPortrait = pFace;
             v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i];
-            if ( pParty->pPartyBuffs[11].uExpireTime )
+            if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime )
                 pRenderer->_4A6E7E(v9, 0x183u, pPortrait);
             else
                 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait);
@@ -2267,7 +2267,7 @@
             pFace = pTexture_PlayerFaceDead;
             pPortrait = pFace;
             v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i];
-            if ( pParty->pPartyBuffs[11].uExpireTime )
+            if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime )
                 pRenderer->_4A6E7E(v9, 0x183u, pPortrait);
             else
                 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait);
@@ -2301,7 +2301,7 @@
                 pFace = (Texture *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture *)pTextures_PlayerFaces[i][pFrame->uTextureID];
                 pPortrait = pFace;
                 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i];
-                if ( pParty->pPartyBuffs[11].uExpireTime )
+                if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime )
                     pRenderer->_4A6E7E(v9, 0x183u, pPortrait);
                 else
                     pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait);
--- a/mm7_2.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/mm7_2.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -149,8 +149,8 @@
       return 0;
     }
     v20 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
-    pParty->pPartyBuffs[18].Apply(pParty->uTimePlayed + 46080, 3u, 0, v20, 0);
-    pParty->pPartyBuffs[18].uFlags |= 1u;
+    pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + 46080, 3u, 0, v20, 0);
+    pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags |= 1u;
     v31 = 0;
     v29 = 0;
     v27 = 0;
@@ -180,8 +180,8 @@
     else
     {
       v19 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536);
-      pParty->pPartyBuffs[7].Apply(pParty->uTimePlayed + 30720, 3u, 1u, v19, 0);
-      pParty->pPartyBuffs[7].uFlags |= 1u;
+      pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + 30720, 3u, 1u, v19, 0);
+      pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags |= 1u;
       v31 = 0;
       v29 = 0;
       v27 = 0;
--- a/mm7_3.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/mm7_3.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -1210,13 +1210,13 @@
             Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0);
             break;
           }
-          //v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0;
-          //v53 = SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) < 0;
+          //v52 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) == 0;
+          //v53 = SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) < 0;
           v0->vVelocity.y = 0;
           v0->vVelocity.x = 0;
-          //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) )
-		  if ( (signed __int64)pParty->pPartyBuffs[11].uExpireTime < 0)
-            pParty->pPartyBuffs[11].Reset();
+          //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0) )
+		  if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime < 0)
+            pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
           viewparams->bRedrawGameUI = 1;
           break;
         case OBJECT_Decoration:
@@ -1918,9 +1918,9 @@
     auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z;
     if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)
     {
-      if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0
-        && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime)) )
-        pParty->pPartyBuffs[11].Reset();
+      if ( SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) >= 0
+        && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime)) )
+        pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
       viewparams->bRedrawGameUI = 1;
       goto LABEL_152;
     }
@@ -2279,10 +2279,10 @@
   {
     //LOBYTE(pParty->uFlags) &= 0x7Fu;
     bWaterWalk = 1;
-    *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u;
+    *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u;
     if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) &&
 		pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster-1].sMana <= 0 )
-		//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 )
+		//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 10] <= 0 )
       bWaterWalk = 0;
   }
   v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &v130, &v108, bWaterWalk);
@@ -2335,8 +2335,8 @@
     else pParty->walk_sound_timer = 0;
   }
   if (!bUnderwater
-    && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0
-    && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0) )
+    && SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime) <= 0
+    && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime) <= 0) )
     pParty->bFlying = false;
   if (!bJumping)
   {
@@ -2424,8 +2424,8 @@
         {
           pParty->bFlying = 0;
           if ( bUnderwater
-            || pParty->pPartyBuffs[7].uFlags & 1
-            || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 )
+            || pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1
+            || pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 10] > 0 )
           {
             pZ -= 30;
             v113 -= 30;
@@ -2671,7 +2671,7 @@
       if ( v127 )
         pZ = v113;
       if (pParty->FlyActive())
-        stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu;
+        stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu;
       pParty->uFallStartY = pZ;
       //goto LABEL_141;
     }
@@ -2684,7 +2684,7 @@
 		pParty->uFallStartY = v111;
 	    v113 = pZ;
 	    if (pParty->FlyActive())
-		  stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;
+		  stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;
 
 	}
   }
@@ -2692,7 +2692,7 @@
   {
 	  v113 = pZ;
 	  if (pParty->FlyActive())
-		stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;
+		stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;
   }
 //LABEL_141:
   if (bJumping && !pParty->bFlying)
@@ -3211,9 +3211,9 @@
     if ( bWaterWalk )
     {
       pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
-      //v79 = 20 * pParty->pPartyBuffs[18].uOverlayID + 6180178;
-      //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u;
-      v79 = (int)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119];
+      //v79 = 20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 6180178;
+      //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u;
+      v79 = (int)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119];
       *(short *)v79 |= 1u;
       if ( !v122 || !v69 )
       {
@@ -6816,8 +6816,8 @@
   if (pWeather->bNight)
   {
     v8 = 67108864;
-    if ( (signed __int64)pParty->pPartyBuffs[16].uExpireTime > 0 )
-      v8 = pParty->pPartyBuffs[16].uPower << 26;
+    if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 )
+      v8 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower << 26;
     if ( a3 <= v8 )
     {
       if ( a3 > 0 )
@@ -6985,12 +6985,12 @@
     }
     else
     {
-      if ( (signed __int64)pParty->pPartyBuffs[16].uExpireTime > 0 )
-      {
-        if ( (signed __int64)pParty->pPartyBuffs[16].uExpireTime <= 0 )
+      if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 )
+      {
+        if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime <= 0 )
           v11 = 0;
         else
-          v11 = pParty->pPartyBuffs[16].uPower;
+          v11 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower;
       }
       v12 = v11 << 26;
     }
@@ -13089,7 +13089,7 @@
         pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u);
         v39 = (signed __int64)((double)(v42 << 7) * 0.033333335);
-        v37 = &pParty->pPartyBuffs[2];
+        v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS];
         v36 = pParty->uTimePlayed + v39;
         v37->Apply(v36, a7b, v43, 0, 0);
         goto LABEL_139;
@@ -13103,7 +13103,7 @@
        pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u);
        pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u);
        v39 = (signed __int64)((double)(v42 << 7) * 0.033333335);
-       v37 = &pParty->pPartyBuffs[2];
+       v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS];
        v36 = pParty->uTimePlayed + v39;
        v37->Apply(v36, a7b, v43, 0, 0);
        goto LABEL_139;
@@ -13116,7 +13116,7 @@
     pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u);
     pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u);
     v39 = (signed __int64)((double)(v42 << 7) * 0.033333335);
-    v37 = &pParty->pPartyBuffs[2];
+    v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS];
     v36 = pParty->uTimePlayed + v39;
     v37->Apply(v36, a7b, v43, 0, 0);
     goto LABEL_139;
@@ -13566,7 +13566,7 @@
         v48 = uSkill;
         v46 = v15;
         v39 = (signed __int64)((double)(v38 << 7) * 0.033333335);
-        v37 = &pParty->pPartyBuffs[10];
+        v37 = &pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION];
         v36 = pParty->uTimePlayed + v39;
         v37->Apply(v36, v46, v48, v50, v52);
         goto LABEL_139;
--- a/mm7_4.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/mm7_4.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -1925,7 +1925,7 @@
         { // colliding with something in the air - fall down
           v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower;
           //__debugbreak();
-		  v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000];
+		  v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 2000];
           v7 = *v6 < v5;
           *v6 -= v5;
           if ( v7 )
@@ -1946,7 +1946,7 @@
         if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) )
         { // taking on water
           //__debugbreak();
-          v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000];
+          v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000];
           v7 = *v8 < v4;
           *v8 -= v4;
           if ( v7 )
@@ -1990,7 +1990,7 @@
       }
       a1.uObjectDescID = v10;
       a1.field_60_distance_related_prolly_lod = 0;
-      v12 = 8 * pParty->pPartyBuffs[10].uCaster;
+      v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster;
       LOBYTE(v12) = v12 | OBJECT_Player;
       a1.uAttributes = 0;
       a1.uSectorID = 0;
@@ -2623,7 +2623,7 @@
     ++v62;
   }
   while ( (signed int)v62 <= (signed int)&pPlayers[4] );
-  v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0;
+  v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0;
 
   for (uint i = 0; i < 20; ++i)
   {
@@ -2631,7 +2631,7 @@
       viewparams->bRedrawGameUI = 1;
   }
 
-  if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 )
+  if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 )
   {
     for (uint i = 0; i < 4; ++i)
       pParty->pPlayers[i].SetCondition(1, 0);
--- a/mm7_6.cpp	Wed Jun 05 17:40:09 2013 +0600
+++ b/mm7_6.cpp	Wed Jun 05 17:40:17 2013 +0600
@@ -1611,7 +1611,7 @@
 		while ( (signed __int64)v6->uExpireTime <= 0 )
 		{
 			++v6;
-			if ( v6 > &pParty->pPartyBuffs[19] )
+			if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] )
 			{
 				v7 = pParty->pPlayers;//[0].pPlayerBuffs;
 				v8 = 0;