changeset 162:8ff698000225

Слияние
author Ritor1
date Fri, 30 Nov 2012 18:14:09 +0600
parents 3ee6e30b7943 (current diff) 062e8a8e09bc (diff)
children 62585ad07024
files mm7_4.cpp
diffstat 10 files changed, 105 insertions(+), 190 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Fri Nov 30 18:13:54 2012 +0600
+++ b/AudioPlayer.cpp	Fri Nov 30 18:14:09 2012 +0600
@@ -1528,7 +1528,8 @@
         while ( v2 < v1->uMixerChannels );
         v2 = 0;
       }
-      v29 = __OFSUB__(v1->uMixerChannels, v2);
+      //v29 = __OFSUB__(v1->uMixerChannels, v2);
+	  v29 = v1->uMixerChannels > v2;
       v3 = v1->uMixerChannels == v2;
       v5 = v1->uMixerChannels - v2 < 0;
       v59 = v2;
--- a/GUIWindow.cpp	Fri Nov 30 18:13:54 2012 +0600
+++ b/GUIWindow.cpp	Fri Nov 30 18:14:09 2012 +0600
@@ -1613,34 +1613,34 @@
 //----- (0044D406) --------------------------------------------------------
 char *GUIWindow::DrawText2(GUIFont *a2, unsigned int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, const char *pInString, unsigned int uLineSpacing)
 {
-  GUIWindow *v7; // esi@1
+  GUIWindow *pWindow; // esi@1
   unsigned int v8; // ebx@1
   char *v9; // eax@1
   char *result; // eax@1
   unsigned int v11; // edi@1
   signed int v12; // esi@1
   int v13; // eax@2
-  GUIFont *v14; // [sp+Ch] [bp-4h]@1
+  GUIFont *pFont; // [sp+Ch] [bp-4h]@1
   const char *Stra; // [sp+24h] [bp+14h]@5
 
-  v7 = this;
-  v14 = a2;
+  pWindow = this;
+  pFont = a2;
   v8 = this->uFrameWidth - uHorizontalMargin;
   ui_current_text_color = uDefaultColor;
   v9 = FitTextInAWindow(pInString, a2, this, uHorizontalMargin, 0);
   result = strtok(v9, "\n");
-  v11 = uHorizontalMargin + v7->uFrameX;
-  v12 = uVerticalMargin + v7->uFrameY;
+  v11 = uHorizontalMargin + pWindow->uFrameX;
+  v12 = uVerticalMargin + pWindow->uFrameY;
   while ( 1 )
   {
     Stra = result;
     if ( !result )
       break;
-    v13 = (signed int)(v8 - v14->GetLineWidth(result)) >> 1;
+    v13 = (signed int)(v8 - pFont->GetLineWidth(result)) >> 1;
     if ( v13 < 0 )
       v13 = 0;
-    v14->DrawTextLine(uDefaultColor, v11 + v13, v12, Stra, 640);
-    v12 += LOBYTE(v14->uFontHeight) - uLineSpacing;
+    pFont->DrawTextLine(uDefaultColor, v11 + v13, v12, Stra, 640);
+    v12 += LOBYTE(pFont->uFontHeight) - uLineSpacing;
     result = strtok(0, "\n");
   }
   return result;
@@ -1839,7 +1839,7 @@
   char v26; // [sp+Fh] [bp-1Dh]@34
   char v27; // [sp+11h] [bp-1Bh]@35
   int v28; // [sp+20h] [bp-Ch]@17
-  GUIWindow *a1; // [sp+24h] [bp-8h]@1
+  GUIWindow *pWindow; // [sp+24h] [bp-8h]@1
   size_t v30; // [sp+28h] [bp-4h]@1
   size_t Str1a; // [sp+40h] [bp+14h]@5
   size_t Str1b; // [sp+40h] [bp+14h]@19
@@ -1847,12 +1847,12 @@
   int v34; // [sp+48h] [bp+1Ch]@26
 
   v8 = a2;
-  a1 = this;
+  pWindow = this;
   v30 = strlen(Str1);
   v9 = v8->GetLineWidth(Str1);
   if ( v9 < Source )
   {
-    a1->DrawText(v8, uX, uY, uColor, Str1, 0, 0, 0);
+    pWindow->DrawText(v8, uX, uY, uColor, Str1, 0, 0, 0);
     return v9;
   }
   strcpy(pTmpBuf2, Str1);
@@ -1902,8 +1902,8 @@
   if ( a8 )
     _strrev(pTmpBuf2);
   Str1b = 0;
-  v13 = uX + a1->uFrameX;
-  v14 = uY + a1->uFrameY;
+  v13 = uX + pWindow->uFrameX;
+  v14 = uY + pWindow->uFrameY;
   if ( (signed int)v30 > 0 )
   {
     Sourcea = &pTmpBuf2[1];
@@ -1929,7 +1929,7 @@
                 Sourcea += 3;
                 v22 = atoi(&Str);
                 v23 = v8->GetLineWidth(&pTmpBuf2[Str1b]);
-                v13 = a1->uFrameZ - v23 - v22;
+                v13 = pWindow->uFrameZ - v23 - v22;
                 v14 = uY;
               }
               else
--- a/GameUIs.cpp	Fri Nov 30 18:13:54 2012 +0600
+++ b/GameUIs.cpp	Fri Nov 30 18:14:09 2012 +0600
@@ -37,10 +37,8 @@
   v16 = 0;
   if ( !pIcons_LOD->uNumPrevLoadedFiles )
     pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-
-  memset(pSavegameUsedSlots, 0, 45 * sizeof(int));
+  memset(pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots));
   memset(pSavegameThumbnails, 0, 45 * sizeof(RGBTexture));
-
   uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE);
   uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE);
   uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE);
@@ -49,10 +47,7 @@
   uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE);
   if ( uDialogueType_ )
   {
-    pRenderer->DrawTextureIndexed(
-      8u,
-      8u,
-      (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
+    pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
     if ( pCurrentScreen == 11 )
     {
       v1 = uTextureID_save_up;
@@ -63,25 +58,16 @@
       v1 = uTextureID_load_up;
       v2 = uTextureID_LS_loadU;
     }
-    pRenderer->DrawTextureIndexed(241u, 302u, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
-    pRenderer->DrawTextureIndexed(18u, 141u, (Texture *)(v1 != -1 ? (int)&pIcons_LOD->pTextures[v1] : 0));
-    pRenderer->DrawTextureIndexed(
-      351u,
-      302u,
-      (Texture *)(uTextureID_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_u] : 0));
+    pRenderer->DrawTextureIndexed(241, 302, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
+    pRenderer->DrawTextureIndexed(18, 141, (Texture *)(v1 != -1 ? (int)&pIcons_LOD->pTextures[v1] : 0));
+    pRenderer->DrawTextureIndexed(351, 302, (Texture *)(uTextureID_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_u] : 0));
   }
   else
   {
     pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
   }
-  pGUIWindow_CurrentMenu = GUIWindow::Create(
-                             saveload_dlg_xs[uDialogueType_],
-                             saveload_dlg_ys[uDialogueType_],
-                             saveload_dlg_zs[uDialogueType_],
-                             saveload_dlg_ws[uDialogueType_],
-                             WINDOW_MainMenu_Load,
-                             0,
-                             0);
+  pGUIWindow_CurrentMenu = GUIWindow::Create(saveload_dlg_xs[uDialogueType_], saveload_dlg_ys[uDialogueType_], saveload_dlg_zs[uDialogueType_],
+                             saveload_dlg_ws[uDialogueType_], WINDOW_MainMenu_Load, 0, 0);
   pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..."
   pRenderer->Present();
   pSavegameList->Initialize(0);
@@ -91,9 +77,7 @@
     uLoadGameUI_SelectedSlot = 0;
   }
   v15.AllocSubIndicesAndIO(0x12Cu, 0);
-
   assert(sizeof(SavegameHeader) == 0x64);
-
   //v3 = 0;
   for (uint i = 0; i < uNumSavegameFiles; ++i)
   {
@@ -109,15 +93,13 @@
       strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty"
       continue;
     }
-
-    v15.LoadFile(pTmpBuf, 1);
+	v15.LoadFile(pTmpBuf, 1);
     v4 = v15.FindContainer("header.bin", true);
     if ( v4 )
       fread(&pSavegameHeader[i], 0x64u, 1u, v4);
     if ( !_strcmpi(pSavegameList->pSavesNames[i], pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7"
       strcpy(pSavegameList->pSavesNames[i], pGlobalTXT_LocalizationStrings[16]);// "Autosave"
-
-    v5 = v15.FindContainer("image.pcx", true);
+	v5 = v15.FindContainer("image.pcx", true);
     if ( !v5 )
     {
       pSavegameUsedSlots[i] = 0;
@@ -158,65 +140,21 @@
   uTextureID_LS_ = pIcons_LOD->LoadTexture(v8, v10);
   uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE);
   uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 198u, 191u, 18u, 1, 0, 0xA5u, 0, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 219u, 191u, 18u, 1, 0, 0xA5u, 1u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 240u, 191u, 18u, 1, 0, 0xA5u, 2u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 261u, 191u, 18u, 1, 0, 0xA5u, 3u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 282u, 191u, 18u, 1, 0, 0xA5u, 4u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 303u, 191u, 18u, 1, 0, 0xA5u, 5u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 324u, 191u, 18u, 1, 0, 0xA5u, 6u, 0, "", 0);
-  ptr_69BD64 = pGUIWindow_CurrentMenu->CreateButton(
-                 241u,
-                 302u,
-                 105u,
-                 40u,
-                 1,
-                 0,
-                 0xA4u,
-                 0,
-                 0,
-                 "",
-                 (Texture *)(uTextureID_LS_ != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_LS_] : 0),
-                 0);
-  ptr_69BD60 = pGUIWindow_CurrentMenu->CreateButton(
-                 350u,
-                 302u,
-                 105u,
-                 40u,
-                 1,
-                 0,
-                 0xA6u,
-                 0,
-                 0,
-                 "",
-                 (Texture *)(uTextureID_x_d != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_d] : 0),
-                 0);
-  ptr_69BD5C = pGUIWindow_CurrentMenu->CreateButton(
-                 215u,
-                 199u,
-                 17u,
-                 17u,
-                 1,
-                 0,
-                 0xA2u,
-                 0,
-                 0,
-                 "",
-                 (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0),
-                 0);
-  v7 = pGUIWindow_CurrentMenu->CreateButton(
-         215u,
-         0x143u,
-         0x11u,
-         0x11u,
-         1,
-         0,
-         0xA3u,
-         uNumSavegameFiles,
-         0,
-         "",
-         (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0),
-         0);
+  pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, 0xA5, 0, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21, 219, 191, 18, 1, 0, 0xA5, 1, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21, 240, 191, 18, 1, 0, 0xA5, 2, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21, 261, 191, 18, 1, 0, 0xA5, 3, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, 0xA5, 4, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, 0xA5, 5, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, 0xA5, 6, 0, "", 0);
+  ptr_69BD64 = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, 0xA4, 0, 0, "",
+                 (Texture *)(uTextureID_LS_ != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_LS_] : 0), 0);
+  ptr_69BD60 = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, 0xA6, 0, 0, "",
+                 (Texture *)(uTextureID_x_d != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_d] : 0), 0);
+  ptr_69BD5C = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, 0xA2, 0, 0, "",
+                 (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0);
+  v7 = pGUIWindow_CurrentMenu->CreateButton(215, 0x143, 0x11, 0x11, 1, 0, 0xA3, uNumSavegameFiles, 0, "",
+         (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0);
   v16 = -1;
   ptr_69BD58 = v7;
 }
--- a/LOD.cpp	Fri Nov 30 18:13:54 2012 +0600
+++ b/LOD.cpp	Fri Nov 30 18:14:09 2012 +0600
@@ -1006,7 +1006,7 @@
   if ( !pDir->pFilename[0] )
     return 2;
   strcpy(pHeader->pSignature, "LOD");
-  pHeader->dword_0000A4 = 100;
+  pHeader->LODSize = 100;
   pHeader->uNumIndices = 1;
   pDir->pFilename[15] = 0;
   pDir->uDataSize = 0;
@@ -1796,7 +1796,7 @@
     while ( v22 < (signed int)v4->uNumSubIndices );
   }
   fwrite(&v4->header, 0x100u, 1u, pFile);
-  fwrite(&Str, 0x20u, 1u, pFile);
+  fwrite(&Str, 0x20, 1, pFile);
   fseek(v4->pFile, Str.uOfsetFromSubindicesStart, 0);
   fwrite(v4->pSubIndices, 0x20u, v4->uNumSubIndices, pFile);
   v26 = 32 * v4->uNumSubIndices;
@@ -2044,7 +2044,7 @@
   this->pSignature[0] = 0;
   this->LodVersion[0] = 0;
   this->LodDescription[0] = 0;
-  this->dword_0000A4 = 0;
+  this->LODSize = 0;
   this->dword_0000A8 = 0;
   this->uNumIndices = 0;
 }
@@ -2070,6 +2070,8 @@
 {
   LOD::File *v1; // esi@1
 
+  memset(pLODName, 0, 256);
+  memset(pContainerName, 0, 16);
   v1 = this;
   v1->pFile = 0;
   v1->pSubIndices = 0;
@@ -2099,6 +2101,7 @@
 //----- (0046172B) --------------------------------------------------------
 LOD::Directory::Directory()
 {
+  memset(pFilename, 0, 16);
   this->pFilename[0] = 0;
   this->uOfsetFromSubindicesStart = 0;
   this->uDataSize = 0;
--- a/LOD.h	Fri Nov 30 18:13:54 2012 +0600
+++ b/LOD.h	Fri Nov 30 18:14:09 2012 +0600
@@ -23,8 +23,9 @@
   {
     inline FileHeader()
     {
-      memset(LodVersion, 0, 8);
-      memset(field_2C, 0, 40);
+      memset(pSignature, 0, 4);
+	  memset(LodVersion, 0, 80);
+      memset(LodDescription, 0, 80);
       memset(array_0000B0, 0, 28);
       memset(array_0000CC, 0, 52);
     }
@@ -32,11 +33,11 @@
     void Reset();
 
     char pSignature[4];
-    char LodVersion[8];
-    char field_C[32];
-    char field_2C[40];
+    char LodVersion[80];
+    //char field_C[32];
+    //char field_2C[40];
     char LodDescription[80];
-    int dword_0000A4;
+    int LODSize;
     int dword_0000A8;
     unsigned int uNumIndices;
     char array_0000B0[28];
--- a/Player.cpp	Fri Nov 30 18:13:54 2012 +0600
+++ b/Player.cpp	Fri Nov 30 18:14:09 2012 +0600
@@ -6514,7 +6514,7 @@
   uLevel = 1;
   uExperience = 251 + rand() % 100;
   uBirthYear = 1147 - rand() % 6;
-  memset(pActiveSkills, 0, 32 * sizeof(short));
+  memset(pActiveSkills, 0, sizeof(pActiveSkills));
   memset(field_152, 0, 64);
   memset(&spellbook, 0, sizeof(PlayerSpells));
 
@@ -6552,7 +6552,7 @@
   int v5; // esi@11
   unsigned __int16 *v6; // edx@11
   int v7; // esi@18
-  unsigned __int16 *v8; // edx@18
+  unsigned __int16 *pActiveSkill; // edx@18
 
   if ( order >= 0 )
   {
@@ -6560,17 +6560,17 @@
     {
       result = (PLAYER_SKILL_TYPE)0;
       v7 = 0;
-      v8 = this->pActiveSkills;
+      pActiveSkill = this->pActiveSkills;
       do
       {
-        if ( *v8 && pSkillAvailabilityPerClass[uClass / 4][result] == 2 )
+        if ( *pActiveSkill && pSkillAvailabilityPerClass[uClass / 4][result] == 2 )
         {
           if ( v7 == order )
             return result;
           ++v7;
         }
         result = (PLAYER_SKILL_TYPE)((int)result + 1);
-        ++v8;
+        ++pActiveSkill;
       }
       while ( (signed int)result < 37 );
     }
@@ -6580,17 +6580,17 @@
       {
         result = (PLAYER_SKILL_TYPE)0;
         v5 = 0;
-        v6 = this->pActiveSkills;
+        pActiveSkill = this->pActiveSkills;
         do
         {
-          if ( *v6 && pSkillAvailabilityPerClass[uClass / 4][result] == 1 )
+          if ( *pActiveSkill && pSkillAvailabilityPerClass[uClass / 4][result] == 1 )
           {
             if ( v5 == order - 2 )
               return result;
             ++v5;
           }
           result = (PLAYER_SKILL_TYPE)((int)result + 1);
-          ++v6;
+          ++pActiveSkill;
         }
         while ( (signed int)result < 37 );
       }
--- a/SaveLoad.cpp	Fri Nov 30 18:13:54 2012 +0600
+++ b/SaveLoad.cpp	Fri Nov 30 18:14:09 2012 +0600
@@ -344,6 +344,9 @@
   }
 
   assert(sizeof(SavegameHeader) == 100);
+  memset(header.pName, 0, 20);
+  memset(header.pLocationName, 0, 20);
+  memset(header.field_30, 0, 52);
   strcpy(header.pLocationName, pCurrentMapName);
   header.uWordTime = pParty->uTimePlayed;
   strcpy(pDir.pFilename, "header.bin");
@@ -666,7 +669,8 @@
 //----- (0045E297) --------------------------------------------------------
 void SavegameList::Initialize(unsigned int bHideEmptySlots)
 {
-  uNumSavegameFiles = 0;
+    memset(pSavegameList, 0, 0x3138);
+	uNumSavegameFiles = 0;
 
   _chdir("saves");
   {
--- a/mm7_2.cpp	Fri Nov 30 18:13:54 2012 +0600
+++ b/mm7_2.cpp	Fri Nov 30 18:14:09 2012 +0600
@@ -11428,7 +11428,7 @@
   int v21; // eax@32
   const char *v22; // ST14_4@32
   int v23; // eax@32
-  const char *v24; // edi@36
+  const char *Str; // edi@36
   int v25; // eax@43
   GUIWindow Dst; // [sp+Ch] [bp-78h]@8
   /*unsigned int Dst; // [sp+Ch] [bp-78h]@8
@@ -11472,7 +11472,7 @@
   }
   if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
   {
-    memset(&Dst, 0, 0x54u);
+    memset(&Dst, 0, 0x54);
     Dst.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240;
     v4 = pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight;
     Dst.uFrameWidth = 220;
@@ -11485,14 +11485,11 @@
     v6 = uLoadGameUI_SelectedSlot;
     if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels)
     {
-      pRenderer->DrawTextureRGB(
-        pGUIWindow_CurrentMenu->uFrameX + 276,
-        pGUIWindow_CurrentMenu->uFrameY + 171,
-        pSavegameThumbnails + uLoadGameUI_SelectedSlot);
+      pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, pSavegameThumbnails + uLoadGameUI_SelectedSlot);
       v6 = uLoadGameUI_SelectedSlot;
     }
     v7 = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName);
-    Dst.DrawText2(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[v7].pName, 3u);
+    Dst.DrawText2(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[v7].pName, 3);
     v8 = (signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60;
     HIDWORD(v32) = (unsigned __int64)((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) >> 32;
     v9 = v8;
@@ -11539,14 +11536,7 @@
     auto _a = aAMPMNames[HIDWORD(v35)];
     auto _m = aMonthNames[v33];
     sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, v36);
-    sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d",
-      _d,
-      v17,
-      (int)v32,
-      _a,
-      7 * v16 + HIDWORD(v15) % 7 + 1,
-      _m,
-      v36);
+    sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", _d, v17, (int)v32, _a, 7 * v16 + HIDWORD(v15) % 7 + 1, _m, v36);
     Dst.DrawText2(pFontSmallnum, 0, 0, 0, pTmpBuf, 3u);
     v1 = 255;
   }
@@ -11573,9 +11563,7 @@
     v19 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[135]);
     pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, v18, 0, 0, 0);
     v20 = (const char *)(pSavegameHeader + uLoadGameUI_SelectedSlot);
-    v21 = pFontSmallnum->AlignText_Center(
-            0xBAu,
-            (const char *)pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
+    v21 = pFontSmallnum->AlignText_Center(0xBAu, (const char *)pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
     pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106u, 0, v20, 185, 0);
     v22 = pGlobalTXT_LocalizationStrings[165];
     v23 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[165]);
@@ -11589,35 +11577,25 @@
       v34 = uNumSavegameFiles;
     a4 = 199;
     v36 = dword_6A0C9C;
-    v24 = (const char *)(&pSavegameHeader[dword_6A0C9C]);
+    Str = (const char *)(&pSavegameHeader[dword_6A0C9C]);
     do
     {
       if ( v36 >= (signed int)v34 )
         break;
       short clr;
-      HIDWORD(v35) = clr = (v36 == uLoadGameUI_SelectedSlot ? GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(
-                                                         v1,
-                                                         v1,
-                                                         0x64) : 0);
+      HIDWORD(v35) = clr = (v36 == uLoadGameUI_SelectedSlot ? GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v1, v1, 0x64) : 0);
       if ( pGUIWindow_CurrentMenu->field_40 != 1 || v36 != uLoadGameUI_SelectedSlot )
       {
-        pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1Bu, a4, clr, v24, 185, 0);
+        pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, Str, 185, 0);
       }
       else
       {
-        v25 = pGUIWindow_CurrentMenu->DrawTextInRect(
-                pFontSmallnum,
-                0x1Bu,
-                a4,
-                clr,
-                (const char *)pKeyActionMap->pPressedKeysBuffer,
-                175,
-                1);
+        v25 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1);
         pGUIWindow_CurrentMenu->DrawFlashingInputCursor(v25 + 27, a4, pFontSmallnum);
       }
       a4 += 21;
       ++v36;
-      v24 += 100;
+      Str += 100;
     }
     while ( a4 < 346 );
   }
@@ -11717,7 +11695,7 @@
   this_.Reset();
   strcpy(this_.LodVersion, "MMVII");
   strcpy(this_.LodDescription, "newmaps for MMVII");
-  this_.dword_0000A4 = 100;
+  this_.LODSize = 100;
   this_.dword_0000A8 = 0;
   a3.dword_000018 = 0;
   a3.word_00001E = 0;
--- a/mm7_3.cpp	Fri Nov 30 18:13:54 2012 +0600
+++ b/mm7_3.cpp	Fri Nov 30 18:14:09 2012 +0600
@@ -19816,7 +19816,7 @@
           {
             v19 = v36;
             v8 = v34;
-            v22 = __OFSUB__(v36, v37);
+            v22 = v36 > v37;
             v20 = v36 == v37;
             v21 = v36 - v37 < 0;
             v6 = v35;
@@ -19859,17 +19859,6 @@
   }
   return pTmpBuf3;
 }
-
-
-
-
-
-
-
-
-
-
-
 //----- (00401000) --------------------------------------------------------
 void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int))
 {
--- a/mm7_4.cpp	Fri Nov 30 18:13:54 2012 +0600
+++ b/mm7_4.cpp	Fri Nov 30 18:14:09 2012 +0600
@@ -5366,10 +5366,10 @@
   Player *pPlayer;
   const char *pSkillName;
 
-  uColor1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xD1u, 0xBBu, 0x61u);
-  uColorTeal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xF7u, 0xF7u);
-  uColorGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
-  uColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
+  uColor1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xD1, 0xBB, 0x61);
+  uColorTeal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xF7, 0xF7);
+  uColorGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFF, 0);
+  uColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF);
   pRenderer->BeginScene();
   pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
   uPlayerCreationUI_SkySliderPos = (GetTickCount() % 12800) / 20;
@@ -5449,7 +5449,7 @@
   {
     Str = pPlayer->pName;
 	pGUIWindow_CurrentMenu->DrawText(pFontCreate, pOrder + 73, 100, 0, pClassNames[(unsigned __int8)pPlayer->uClass], 0, 0, 0);
-    pRenderer->DrawTextureTransparent(pOrder + 77, 50u, pTexture_IC_KNIGHT[pPlayer->uClass/4]);
+    pRenderer->DrawTextureTransparent(pOrder + 77, 50, pTexture_IC_KNIGHT[pPlayer->uClass/4]);
     v11 = pGUIWindow_CurrentMenu->field_40;
     if ( v11 && (v12 = pGUIWindow_CurrentMenu->ptr_1C, v12 == v124) )
     {
@@ -5485,7 +5485,7 @@
           }
           if ( v120 && v126 != v120 )
             strcpy(Str, (const char *)pKeyActionMap->pPressedKeysBuffer);
-          pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 0x7Cu, 0, Str, 130, 0);
+          pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 0x7C, 0, Str, 130, 0);
           *((short *)pPlayer->pName + 3323) = 1;
         }
       }
@@ -5872,7 +5872,7 @@
   Player *v11; // esi@38
   signed int uSpellBookPageCount; // ecx@40
   int v13; // eax@40
-  signed int v14; // eax@45
+  signed int uSkillIdx; // eax@45
   int v15; // eax@70
   signed int v16; // ecx@70
   unsigned int v18; // [sp-4h] [bp-84h]@48
@@ -5994,13 +5994,14 @@
   }
   while ( (signed int)v1 < 32 );
   item.Reset();
-  v10 = (char *)&pParty->pPlayers[0].sResMagicBase;
-  for ( pPlayer = &pParty->pPlayers[0];  (signed int)v10 < (signed int)((char *)&pParty->field_871C[455] + 2); pPlayer++)
-  {
-    v11 = pPlayer;
+  //v10 = (char *)&pParty->pPlayers[0].sResMagicBase;
+  for ( pPlayer = &pParty->pPlayers[0];  pPlayer < &pParty->pPlayers[4]; pPlayer++)
+  {
+    //v11 = pPlayer;
     if ( !pPlayer->uClass )
       pPlayer->sResMagicBase = 10;
-    *((short *)v10 + 400) = 0;
+    //*((short *)v10 + 400) = 0;
+	pPlayer->pPlayerBuffs[22].uExpireTime = 0;
     uSpellBookPageCount = 0;
 	for ( int i = 0; i < 9; i++)
     {
@@ -6009,14 +6010,14 @@
     }
     pPlayer->pNumSpellBookPage = uSpellBookPageCount;
     pItemsTable->GenerateItem(2, 40, &item);
-    pPlayer->AddItem2(0xFFFFFFFFu, &item);
-    v14 = 0;
+    pPlayer->AddItem2(-1, &item);
+    uSkillIdx = 0;
     v24.y = 0;
     do
     {
-      if ( pPlayer->pActiveSkills[v14] )
-      {
-        switch ( v14 )
+      if ( pPlayer->pActiveSkills[uSkillIdx] )
+      {
+        switch ( uSkillIdx )
         {
           case 0:
             v18 = 61;
@@ -6106,13 +6107,13 @@
          }
         pPlayer->sHealth = pPlayer->GetMaxHealth();
         pPlayer->sMana = pPlayer->GetMaxMana();
-        v14 = v24.y;
-      }
-      ++v14;
-      v24.y = v14;
-    }
-    while ( v14 < 37 );
-    v10 += 6972;
+        uSkillIdx = v24.y;
+      }
+      ++uSkillIdx;
+      v24.y = uSkillIdx;
+    }
+    while ( uSkillIdx < 37 );
+    //v10 += 6972;
 	//pPlayer++;
   }
   //while ( (signed int)v10 < (signed int)((char *)&pParty->field_871C[455] + 2) );