changeset 114:8e802a11b20d

Merge
author Nomad
date Wed, 07 Nov 2012 20:26:28 +0200
parents 9a99c386885a (current diff) 8feb2dfd2f89 (diff)
children 75faebd0a975
files LOD.h mm7_3.cpp
diffstat 6 files changed, 543 insertions(+), 466 deletions(-) [+]
line wrap: on
line diff
--- a/LOD.cpp	Wed Nov 07 20:23:04 2012 +0200
+++ b/LOD.cpp	Wed Nov 07 20:26:28 2012 +0200
@@ -1019,8 +1019,8 @@
   v4->pFile = v6;
   if ( !v6 )
     return 3;
-  fwrite(pHeader, 0x100u, 1u, v6);
-  fwrite(pDir, 0x20u, 1u, v4->pFile);
+  fwrite(pHeader, 0x100, 1, v6);
+  fwrite(pDir, 0x20, 1, v4->pFile);
   fclose(v4->pFile);
   v4->pFile = 0;
   return 0;
@@ -1518,7 +1518,7 @@
   v13 = v12;
   if ( v12 )
   {
-    fwrite(&v1->header, 0x100u, 1u, v12);
+    fwrite(&v1->header, 0x100, 1, v12);
 
     LOD::Directory v0; // [sp+20Ch] [bp-28h]@11
     //LOD::Directory::LOD::Directory(&v0);
@@ -1530,8 +1530,8 @@
     v0.word_00001E = 0;
     v0.uDataSize = v21;
     v0.uNumSubIndices = LOWORD(v1->uNumSubIndices);
-    fwrite(&v0, 0x20u, 1u, v13);
-    fwrite(v1->pSubIndices, 0x20u, v1->uNumSubIndices, v13);
+    fwrite(&v0, 0x20, 1, v13);
+    fwrite(v1->pSubIndices, 0x20, v1->uNumSubIndices, v13);
     v16 = v1->pOutputFileHandle;
     v22 = v2;
     fseek(v16, 0, 0);
@@ -1542,8 +1542,8 @@
         v17 = v1->uIOBufferSize;
         if ( v22 <= (signed int)v17 )
           v17 = v22;
-        fread(v1->pIOBuffer, 1u, v17, v1->pOutputFileHandle);
-        fwrite(v1->pIOBuffer, 1u, v17, v13);
+        fread(v1->pIOBuffer, 1, v17, v1->pOutputFileHandle);
+        fwrite(v1->pIOBuffer, 1, v17, v13);
         v22 -= v17;
       }
       while ( v22 > 0 );
@@ -1645,6 +1645,193 @@
 // 6A0CA8: using guessed type int 6A0CA8_lod_unused;
 
 //----- (00461B48) --------------------------------------------------------
+/*unsigned int LODWriteableFile::Write(const LOD::Directory *pDir, const void *pDirData, int a4)
+{
+  LODWriteableFile *v4; // ebx@1
+  int v5; // esi@1
+  unsigned __int8 v7; // zf@7
+  unsigned __int8 v8; // sf@7
+  const LOD::Directory *v9; // edi@9
+  int v10; // eax@9
+  unsigned __int8 v11; // of@15
+  unsigned __int16 v12; // dx@17
+  LOD::Directory *v13; // eax@17
+  unsigned __int16 v14; // cx@17
+  int v15; // edi@27
+  unsigned int v16; // eax@27
+  int v17; // eax@29
+  int v18; // edx@31
+  int v19; // eax@31
+  void *v20; // edi@32
+  LOD::Directory *v21; // edi@34
+  signed int v22; // esi@34
+  int v23; // eax@34
+  LOD::Directory *v24; // ecx@35
+  int v25; // edx@35
+  __int32 v26; // eax@37
+  int i; // esi@39
+  __int32 v28; // esi@46
+  char pFilename[256]; // [sp+Ch] [bp-230h]@22
+  char NewFilename[256]; // [sp+10Ch] [bp-130h]@51
+  //LOD::Directory Str; // [sp+20Ch] [bp-30h]@27
+  size_t v33; // [sp+22Ch] [bp-10h]@27
+  int v34; // [sp+230h] [bp-Ch]@7
+  __int32 v35; // [sp+234h] [bp-8h]@8
+  int v36; // [sp+238h] [bp-4h]@7
+  size_t Count; // [sp+244h] [bp+8h]@40
+  __int32 Countc; // [sp+244h] [bp+8h]@46
+  size_t Countb; // [sp+244h] [bp+8h]@47
+  FILE *pFile; // [sp+24Ch] [bp+10h]@22
+
+  v4 = this;
+  v5 = 0;
+  if ( !this->isFileOpened )
+    return 1;
+  if ( !this->pSubIndices )
+    return 2;
+  if ( !this->pIOBuffer || !this->uIOBufferSize )
+    return 3;
+  v7 = this->uNumSubIndices == 0;
+  v8 = (this->uNumSubIndices & 0x80000000u) != 0;
+  v36 = 0;
+  v34 = 0;
+  if ( v8 | v7 )
+  {
+    v9 = pDir;
+    goto LABEL_22;
+  }
+  v35 = 0;
+  while ( 1 )
+  {
+    v9 = pDir;
+    v10 = _strcmpi((const char *)v4->pSubIndices + v35, (const char *)pDir);
+    if ( v10 )
+    {
+      if ( v10 > 0 )
+        goto LABEL_22;
+      goto LABEL_15;
+    }
+    if ( !a4 )
+      goto LABEL_20;
+    if ( a4 == 1 )
+      break;
+    if ( a4 == 2 )
+      return 4;
+LABEL_15:
+    v35 += 32;
+    ++v5;
+    v11 = __OFSUB__(v5, v4->uNumSubIndices);
+    v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0;
+    v34 = v5;
+    if ( !(v8 ^ v11) )
+      goto LABEL_22;
+  }
+  v12 = pDir->uNumSubIndices;
+  v13 = &v4->pSubIndices[v5];
+  v14 = v13->uNumSubIndices;
+  if ( v14 >= v12 && (v14 != v12 || (unsigned __int16)v13->word_00001E >= pDir->word_00001E) )
+    return 4;
+LABEL_20:
+  v36 = 1;
+LABEL_22:
+  strcpy(pFilename, "lod.tmp");
+  pFile = fopen(pFilename, "wb+");
+  if ( !pFile )
+    return 5;
+  if ( v36 )
+    v35 = v4->pSubIndices[v5].uDataSize;
+  else
+    v35 = 0;
+  v33 = v9->uDataSize;
+  v15 = v33 - v35;
+
+  LOD::Directory Str; // [sp+20Ch] [bp-30h]@27
+  //LOD::Directory::LOD::Directory(&Str);
+
+  strcpy((char *)&Str, "chapter");
+  v16 = v4->uLODDataSize;
+  Str.uNumSubIndices = LOWORD(v4->uNumSubIndices);
+  Str.dword_000018 = 0;
+  Str.word_00001E = 0;
+  if ( !v36 )
+  {
+    ++Str.uNumSubIndices;
+    v15 += 32;
+  }
+  v7 = v36 == 0;
+  Str.uDataSize = v15 + v16;
+  Str.uOfsetFromSubindicesStart = 288;
+  v17 = (signed __int16)Str.uNumSubIndices;
+  v4->uNumSubIndices = (signed __int16)Str.uNumSubIndices;
+  if ( v7 && v17 > v5 )
+  {
+    v18 = v17;
+    v19 = v17 - v5;
+    do
+    {
+      v20 = &v4->pSubIndices[v18];
+      --v18;
+      --v19;
+      memcpy(v20, (char *)v20 - 32, 0x20u);
+    }
+    while ( v19 );
+    v5 = v34;
+  }
+  v34 = 32 * v5;
+  memcpy(&v4->pSubIndices[v5], pDir, sizeof(v4->pSubIndices[v5]));
+  v23 = 32 * v4->uNumSubIndices;
+  if ( (signed int)v4->uNumSubIndices > 0 )
+  {
+    for (int i =  0; i < (signed int)v4->uNumSubIndices; ++i)
+    {
+      v4->pSubIndices[i].uOfsetFromSubindicesStart = v23;
+      v23 += v4->pSubIndices[i].uDataSize;
+    }
+  }
+  fwrite(&v4->header, 0x100, 1, pFile);
+  fwrite(&Str, 0x20, 1, pFile);
+  fseek(v4->pFile, Str.uOfsetFromSubindicesStart, 0);
+  fwrite(v4->pSubIndices, 0x20u, v4->uNumSubIndices, pFile);
+  v26 = 32 * v4->uNumSubIndices;
+  if ( !v36 )
+    v26 -= 32;
+  fseek(v4->pFile, v26, 1);
+  for ( i = *(unsigned int *)((char *)&v4->pSubIndices->uOfsetFromSubindicesStart + v34)
+          - v4->pSubIndices->uOfsetFromSubindicesStart; i > 0; i -= Count )
+  {
+    Count = v4->uIOBufferSize;
+    if ( i <= (signed int)v4->uIOBufferSize )
+      Count = i;
+    fread(v4->pIOBuffer, 1u, Count, v4->pFile);
+    fwrite(v4->pIOBuffer, 1u, Count, pFile);
+  }
+  fwrite(pDirData, 1u, v33, pFile);
+  if ( v36 )
+    fseek(v4->pFile, v35, 1);
+  Countc = ftell(v4->pFile);
+  fseek(v4->pFile, 0, 2);
+  v28 = ftell(v4->pFile) - Countc;
+  fseek(v4->pFile, Countc, 0);
+  while ( v28 > 0 )
+  {
+    Countb = v4->uIOBufferSize;
+    if ( v28 <= (signed int)v4->uIOBufferSize )
+      Countb = v28;
+    fread(v4->pIOBuffer, 1u, Countb, v4->pFile);
+    fwrite(v4->pIOBuffer, 1u, Countb, pFile);
+    v28 -= Countb;
+  }
+  strcpy(NewFilename, (const char *)v4->pLODName);
+  fclose(pFile);
+  v4->CloseWriteFile();
+  remove(NewFilename);
+  rename(pFilename, NewFilename);
+  v4->CloseWriteFile();
+  v4->LoadFile(v4->pLODName, 0);
+  return 0;
+}
+*/
+
 unsigned int LODWriteableFile::Write(const LOD::Directory *pDir, const void *pDirData, int a4)
 {
   LODWriteableFile *v4; // ebx@1
@@ -1777,27 +1964,19 @@
     while ( v19 );
     v5 = v34;
   }
-  v21 = v4->pSubIndices;
   v34 = 32 * v5;
-  memcpy(&v21[v5], pDir, sizeof(v21[v5]));
-  v22 = 0;
+  memcpy(&v4->pSubIndices[v5], pDir, sizeof(v4->pSubIndices[v5]));
   v23 = 32 * v4->uNumSubIndices;
   if ( (signed int)v4->uNumSubIndices > 0 )
   {
-    v24 = v4->pSubIndices;
-    v25 = 0;
-    do
+    for (int i =  0; i < (signed int)v4->uNumSubIndices; ++i)
     {
-      v24[v25].uOfsetFromSubindicesStart = v23;
-      v24 = v4->pSubIndices;
-      v23 += v24[v25].uDataSize;
-      ++v22;
-      ++v25;
+      v4->pSubIndices[i].uOfsetFromSubindicesStart = v23;
+      v23 += v4->pSubIndices[i].uDataSize;
     }
-    while ( v22 < (signed int)v4->uNumSubIndices );
   }
-  fwrite(&v4->header, 0x100u, 1u, pFile);
-  fwrite(&Str, 0x20u, 1u, pFile);
+  fwrite(&v4->header, 0x100, 1, pFile);
+  fwrite(&Str, 0x20, 1, pFile);
   fseek(v4->pFile, Str.uOfsetFromSubindicesStart, 0);
   fwrite(v4->pSubIndices, 0x20u, v4->uNumSubIndices, pFile);
   v26 = 32 * v4->uNumSubIndices;
@@ -2043,8 +2222,8 @@
 void LOD::FileHeader::Reset()
 {
   this->pSignature[0] = 0;
-  this->array_000004[0] = 0;
-  this->array_000054[0] = 0;
+  this->LodVersion[0] = 0;
+  this->LodDescription[0] = 0;
   this->dword_0000A4 = 0;
   this->dword_0000A8 = 0;
   this->uNumIndices = 0;
--- a/LOD.h	Wed Nov 07 20:23:04 2012 +0200
+++ b/LOD.h	Wed Nov 07 20:26:28 2012 +0200
@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <memory.h>
 #include "Texture.h"
-
+#include <memory.h>
 
 
 /*  354 */
@@ -30,8 +30,8 @@
     void Reset();
 
     unsigned __int8 pSignature[4];
-    char array_000004[80];
-    char array_000054[80];
+    char LodVersion[80];
+    char LodDescription[80];
     int dword_0000A4;
     int dword_0000A8;
     unsigned int uNumIndices;
--- a/SaveLoad.cpp	Wed Nov 07 20:23:04 2012 +0200
+++ b/SaveLoad.cpp	Wed Nov 07 20:26:28 2012 +0200
@@ -228,7 +228,7 @@
 int __fastcall SaveGame(int a1, __int16 *a2)
 {
   int result; // eax@1
-  void *v3; // edi@5
+  void *pScreenshot; // edi@5
   int v4; // eax@6
   int v5; // eax@6
   int v6; // eax@6
@@ -264,20 +264,19 @@
   const char *v36; // [sp-10h] [bp-280h]@6
   const char *v37; // [sp-Ch] [bp-27Ch]@6
   const char *v38; // [sp-8h] [bp-278h]@8
-  int v39; // [sp-4h] [bp-274h]@8
   CHAR Buffer; // [sp+Ch] [bp-264h]@59
   char Dir; // [sp+8Ch] [bp-1E4h]@51
   char Drive; // [sp+ACh] [bp-1C4h]@51
   int v43; // [sp+CCh] [bp-1A4h]@10
   char Dest[20]; // [sp+E0h] [bp-190h]@10
-  unsigned __int64 v45; // [sp+F4h] [bp-17Ch]@10
+  unsigned __int64 pTimePlayed; // [sp+F4h] [bp-17Ch]@10
   char Filename; // [sp+130h] [bp-140h]@51
   char Ext; // [sp+150h] [bp-120h]@51
   char v48; // [sp+151h] [bp-11Fh]@51
   char Source[32]; // [sp+170h] [bp-100h]@51
   char Str[120]; // [sp+190h] [bp-E0h]@8
   int v51; // [sp+208h] [bp-68h]@2
-  int v52; // [sp+20Ch] [bp-64h]@2
+  int pPositionX; // [sp+20Ch] [bp-64h]@2
   int v53; // [sp+210h] [bp-60h]@2
   int v54; // [sp+214h] [bp-5Ch]@2
   int Src; // [sp+218h] [bp-58h]@30
@@ -289,7 +288,6 @@
   int v61; // [sp+224h] [bp-4Ch]@30
   int v62; // [sp+228h] [bp-48h]@2
   LOD::Directory pDir; // [sp+22Ch] [bp-44h]@2
-  //std::string *v64; // [sp+24Ch] [bp-24h]@1
   size_t Size; // [sp+250h] [bp-20h]@26
   __int16 *v66; // [sp+254h] [bp-1Ch]@1
   void *DstBuf; // [sp+258h] [bp-18h]@2
@@ -298,359 +296,300 @@
   int v70; // [sp+264h] [bp-Ch]@22
   std::string *v71; // [sp+268h] [bp-8h]@8
   int a3; // [sp+26Fh] [bp-1h]@8
-
+  
   v66 = a2;
-  //v64 = (std::string *)a1;
-
   strcpy(byte_6BE3B0, pCurrentMapName);
   if (!_strcmpi(pCurrentMapName, "d05.blv"))
     return false;
-
-  DstBuf = malloc(0xF4240u);
+  DstBuf = malloc(0xF4240);
   pDir.Reset();
-    v52 = pParty->vPosition.x;
-    v51 = pParty->vPosition.y;
-    v62 = pParty->vPosition.z;
-    v53 = pParty->sRotationY;
-    v54 = pParty->sRotationX;
+  pPositionX = pParty->vPosition.x;
+  v51 = pParty->vPosition.y;
+  v62 = pParty->vPosition.z;
+  v53 = pParty->sRotationY;
+  v54 = pParty->sRotationX;
   pParty->vPosition.x = pParty->vPrevPosition.x;
   pParty->vPosition.y = pParty->vPrevPosition.z;
   pParty->vPosition.z = pParty->vPrevPosition.y;
   pParty->uFallStartY = pParty->vPrevPosition.y;
   pParty->sRotationY = pParty->sPrevRotationY;
   pParty->sRotationX = pParty->sPrevRotationX;
-
   if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
     pIndoor->stru1.uLastVisitDay = pParty->uTimePlayed;
   else
     pOutdoor->uLastVisitDay = pParty->uTimePlayed;
-
-  v3 = MakeScreenshot(150, 112);
+  pScreenshot = MakeScreenshot(150, 112);
+  strcpy(pDir.pFilename, "image.pcx");
+  pRenderer->_49F5A2((int)pScreenshot, 150, 112, DstBuf, 1000000, (int)&pDir.uDataSize);
+  free(pScreenshot);
+  if ( pCurrentScreen == 11 )//SaveScreen
+  {
+    pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
+    pRenderer->DrawTextureIndexed(0x12, 0x8D, (Texture *)(uTextureID_save_up != -1 ? &pIcons_LOD->pTextures[uTextureID_save_up] : 0));
+    v4 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[190]);
+    pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v4 + 25, 219, 0, pGlobalTXT_LocalizationStrings[190], 0, 0, 0); //Сохранение
+    v5 = pFontSmallnum->AlignText_Center(0xBA, (const char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
+    pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v5 + 25, 0x103u, 0, (const char *)(&pSavegameHeader + uLoadGameUI_SelectedSlot), 185, 0);
+    v6 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);
+    pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v6 + 25, 299, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); //Пожалуйста, подождите
+    pRenderer->Present();
+   }
+  if ( pNew_LOD->Write(&pDir, DstBuf, 0) )
+  {
+    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 200); //Сохраненная игра повреждена! Code=%d
+    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0);
+  }
+  strcpy(Dest, pCurrentMapName);
+  pTimePlayed = pParty->uTimePlayed;
+  strcpy((char *)&pDir, "header.bin");
+  pDir.uDataSize = 100;
+  if ( pNew_LOD->Write(&pDir, &v43, 0) )
+  {
+    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 201);
+    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:784", 0);
+  }
+  strcpy((char *)&pDir, "party.bin");
+  pDir.uDataSize = 90680;
+  if ( pNew_LOD->Write(&pDir, &pParty, 0) )
   {
-    strcpy(pDir.pFilename, "image.pcx");
-
-    pRenderer->_49F5A2((int)v3, 150, 112, DstBuf, 1000000, (int)&pDir.uDataSize);
+    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 202);
+    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0);
+  }
+  strcpy((char *)&pDir, "clock.bin");
+  pDir.uDataSize = 40;
+  if ( pNew_LOD->Write(&pDir, &pEventTimer, 0) )
+  {
+    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 203);
+    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:802", 0);
+  }
+  strcpy((char *)&pDir, "overlay.bin");
+  pDir.uDataSize = 1008;
+  if ( pNew_LOD->Write(&pDir, &pOtherOverlayList, 0) )
+  {
+    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 204);
+    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0);
   }
-  free(v3);
-
-    if ( pCurrentScreen == 11 )
+  strcpy((char *)&pDir, "npcdata.bin");
+  pDir.uDataSize = 38076;
+  if ( pNew_LOD->Write(&pDir, pNPCStats->pNewNPCData, 0) )
+  {
+    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 205);
+    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0);
+  }
+  strcpy((char *)&pDir, "npcgroup.bin");
+  pDir.uDataSize = 102;
+  if ( pNew_LOD->Write(&pDir, pNPCStats->pGroups_copy, 0) )
+  {
+    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 206);
+    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:829", 0);
+  }
+  for (int i =  1; i <= 4; ++i) // 4 - players
+  {
+    for (int j =  1; j <= 5; ++j) // 5 - images
     {
-      pRenderer->DrawTextureIndexed(
-        8u,
-        8u,
-        (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
-      pRenderer->DrawTextureIndexed(
-        0x12u,
-        0x8Du,
-        (Texture *)(uTextureID_save_up != -1 ? &pIcons_LOD->pTextures[uTextureID_save_up] : 0));
-      v36 = pGlobalTXT_LocalizationStrings[190];
-      v4 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[190]);
-      pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v4 + 25, 219, 0, v36, 0, 0, 0);
-      v37 = (const char *)(&pSavegameHeader + uLoadGameUI_SelectedSlot);
-      v5 = pFontSmallnum->AlignText_Center(0xBAu,
-             (const char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
-      pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v5 + 25, 0x103u, 0, v37, 185, 0);
-      v36 = pGlobalTXT_LocalizationStrings[165];
-      v6 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[165]);
-      pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v6 + 25, 299, 0, v36, 0, 0, 0);
-      pRenderer->Present();
-    }
-    if ( pNew_LOD->Write(&pDir, DstBuf, 0) )
+      sprintf(Str, "data\\lloyd%d%d.pcx", i, j);
+      v8 = fopen(Str, "rb");
+      if ( v8 )
+      {
+        sprintf(Str, "lloyd%d%d.pcx", i, j);
+        fseek(v8, 0, 2);
+        pDir.uDataSize = ftell(v8);
+        rewind(v8);
+        fread(DstBuf, pDir.uDataSize, 1, v8);
+        strcpy((char *)&pDir, Str);
+        fclose(v8);
+        remove(Str);
+        if ( pNew_LOD->Write(&pDir, DstBuf, 0) )
+        {
+          sprintf(Str, pGlobalTXT_LocalizationStrings[612], 207);
+          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:857", 0);
+          Size = 5080748;
+        }
+      }
+	}
+  }
+  if ( !a2 )
+  {
+    sub_42FA22_mess_with_laying_item_list();
+    v9 = (int)malloc(0xF4240);
+    v71 = (std::string *)v9;
+    Src = 91969;
+    v56 = 109;
+    v57 = 118;
+    v58 = 105;
+    v59 = 105;
+    v60 = 0;
+    v61 = 0;
+    memcpy((void *)v9, &Src, 0x10);
+    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
     {
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 200);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0);
+      pIndoor->dlv.uNumFacesInBModels = pIndoor->uNumFaces;
+      pIndoor->dlv.uNumBModels = 0;
+      pIndoor->dlv.uNumDecorations = uNumLevelDecorations;
+      memcpy(DstBuf, &pIndoor->dlv, 0x28);
+      v10 = (char *)DstBuf + 40;
+      memcpy(v10, pIndoor->_visible_outlines, 0x36B);
+      v11 = (char *)v10 + 875;
+      if ( (signed int)pIndoor->uNumFaces > 0 )
+      {
+        v68 = 0;
+        for (int i =  0; i <= (signed int)pIndoor->uNumFaces; ++i)
+        {
+          v38 = (char *)v68 + (unsigned int)pIndoor->pFaces + 44;
+          memcpy(v11, v38, 4);
+          v68 += 48;
+          v11 = (char *)v11 + 4;
+        }
+      }
+      if ( (signed int)uNumLevelDecorations > 0 )
+      {
+        v68 = &pLevelDecorations[0].field_2;
+        for (int i =  0; i <= (signed int)uNumLevelDecorations; ++i)
+        {
+          memcpy(v11, v68, 2);
+          v68 += 16;
+          v11 = (char *)v11 + 2;
+        }
+      }
+      memcpy(v11, &uNumActors, 4);
+      v12 = (char *)v11 + 4;
+      memcpy(v12, pActors, 836 * uNumActors);
+      v13 = (char *)v12 + 836 * uNumActors;
+      memcpy(v13, &uNumLayingItems, 4);
+      v13 = (char *)v13 + 4;
+      memcpy(v13, pLayingItems, 112 * uNumLayingItems);
+      v14 = (char *)v13 + 112 * uNumLayingItems;
+      memcpy(v14, &uNumChests, 4);
+      v14 = (char *)v14 + 4;
+      memcpy(v14, pChests, 5324 * uNumChests);
+      v15 = (char *)v14 + 5324 * uNumChests;
+      memcpy(v15, pIndoor->pDoors, 0x3E80);
+      v15 = (char *)v15 + 16000;
+      memcpy(v15, pIndoor->ptr_0002B4_doors_ddata, pIndoor->blv.uDoors_ddata_Size);
+      v16 = (char *)v15 + pIndoor->blv.uDoors_ddata_Size;
+      memcpy(v16, &stru_5E4C90, 0xC8);
+      v17 = (int)((char *)v16 + 200);
+      memcpy((void *)v17, &pIndoor->stru1, 0x38);
     }
     else
     {
-      v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp";
-    }
-    strcpy(Dest, pCurrentMapName);
-    v45 = pParty->uTimePlayed;
-    strcpy((char *)&pDir, "header.bin");
-    pDir.uDataSize = 100;
-    if ( pNew_LOD->Write(&pDir, &v43, 0) )
-    {
-      v39 = 201;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 201);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:784", 0);
-    }
-    strcpy((char *)&pDir, "party.bin");
-    pDir.uDataSize = 90680;
-    if ( pNew_LOD->Write(&pDir, &pParty, 0) )
-    {
-      v39 = 202;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 202);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0);
-    }
-    strcpy((char *)&pDir, "Timer.bin");
-    pDir.uDataSize = 40;
-    if ( pNew_LOD->Write(&pDir, &pEventTimer, 0) )
-    {
-      v39 = 203;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 203);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:802", 0);
-    }
-    strcpy((char *)&pDir, "overlay.bin");
-    pDir.uDataSize = 1008;
-    if ( pNew_LOD->Write(&pDir, &pOtherOverlayList, 0) )
-    {
-      v39 = 204;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 204);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0);
-    }
-    strcpy((char *)&pDir, "npcdata.bin");
-    pDir.uDataSize = 38076;
-    if ( pNew_LOD->Write(&pDir, pNPCStats->pNewNPCData, 0) )
-    {
-      v39 = 205;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 205);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0);
-    }
-    strcpy((char *)&pDir, "npcgroup.bin");
-    pDir.uDataSize = 102;
-    if ( pNew_LOD->Write(&pDir, pNPCStats->pGroups_copy, 0) )
-    {
-      v39 = 206;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 206);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:829", 0);
-    }
-    v70 = 1;
-    do
-    {
-      v69 = 1;
-      do
+      v18 = 0;
+      pOutdoor->ddm.uNumFacesInBModels = 0;
+      if ( (signed int)pOutdoor->uNumBModels > 0 )
       {
-        v39 = v69;
-        v38 = (const char *)v70;
-        sprintf(Str, "data\\lloyd%d%d.pcx", v70, v69);
-        v8 = fopen(Str, "rb");
-        if ( v8 )
+        v19 = pOutdoor->uNumBModels;
+        v20 = (char *)&pOutdoor->pBModels->uNumFaces;
+        do
         {
-          v39 = v69;
-          v38 = (const char *)v70;
-          sprintf(Str, "lloyd%d%d.pcx", v70, v69);
-          fseek(v8, 0, 2);
-          pDir.uDataSize = ftell(v8);
-          rewind(v8);
-          fread(DstBuf, pDir.uDataSize, 1u, v8);
-          strcpy((char *)&pDir, Str);
-          fclose(v8);
-          remove(Str);
-          if ( pNew_LOD->Write(&pDir, DstBuf, 0) )
-          {
-            v39 = 207;
-            sprintf(Str, pGlobalTXT_LocalizationStrings[612], 207);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:857", 0);
-            Size = 5080748;
-          }
+          v18 += *(int *)v20;
+          v20 += 188;
+          --v19;
+          pOutdoor->ddm.uNumFacesInBModels = v18;
         }
-        ++v69;
+        while ( v19 );
       }
-      while ( (signed int)v69 <= 5 );
-      ++v70;
-    }
-    while ( v70 <= 4 );
-    if ( !a2 )
-    {
-      sub_42FA22_mess_with_laying_item_list();
-      v9 = (int)malloc(0xF4240u);
-      v71 = (std::string *)v9;
-      Src = 91969;
-      v56 = 109;
-      v57 = 118;
-      v58 = 105;
-      v59 = 105;
-      v60 = 0;
-      v61 = 0;
-      memcpy((void *)v9, &Src, 0x10u);
-      if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
+      v21 = DstBuf;
+      pOutdoor->ddm.uNumBModels = pOutdoor->uNumBModels;
+      pOutdoor->ddm.uNumDecorations = uNumLevelDecorations;
+      memcpy(DstBuf, &pOutdoor->ddm, 0x28);
+      v21 = (char *)v21 + 40;
+      memcpy(v21, pOutdoor->array_528, 0x3C8);
+      v21 = (char *)v21 + 968;
+      memcpy(v21, pOutdoor->array_8F0, 0x3C8);
+      v22 = (char *)v21 + 968;
+      if ( (signed int)pOutdoor->uNumBModels > 0 )
       {
-        v10 = DstBuf;
-        pIndoor->dlv.uNumFacesInBModels = pIndoor->uNumFaces;
-        pIndoor->dlv.uNumBModels = 0;
-        pIndoor->dlv.uNumDecorations = uNumLevelDecorations;
-        memcpy(DstBuf, &pIndoor->dlv, 0x28u);
-        v10 = (char *)v10 + 40;
-        memcpy(v10, pIndoor->_visible_outlines, 0x36Bu);
-        v11 = (char *)v10 + 875;
-        v70 = 0;
-        if ( (signed int)pIndoor->uNumFaces > 0 )
+        v23 = pOutdoor->pBModels;
+        v24 = 76;
+        for (int i =  0; i <= (signed int)pOutdoor->uNumBModels ; ++i)
         {
-          v68 = 0;
-          do
+          v25 = *(int *)&v23->pModelName[v24] == 0;
+          v26 = *(int *)&v23->pModelName[v24] < 0;
+          if ( !(v26 | v25) )
           {
-            v38 = (char *)v68 + (unsigned int)pIndoor->pFaces + 44;
-            memcpy(v11, v38, 4u);
-            v68 += 48;
-            v11 = (char *)v11 + 4;
-            ++v70;
-          }
-          while ( v70 < (signed int)pIndoor->uNumFaces );
+            v68 = 0;
+            for (int j =  0; j <= *(int *)&pOutdoor->pBModels->pModelName[v24]; ++j)
+            {
+              v38 = (char *)v68 + *(int *)&v23->pModelName[v24 + 8] + 28;
+              memcpy(v22, v38, 4);
+              v23 = pOutdoor->pBModels;
+              v68 += 154;
+              v22 = (char *)v22 + 4;
+            }
+           }
+          v24 += 188;
         }
-        v70 = 0;
-        if ( (signed int)uNumLevelDecorations > 0 )
+      }
+      if ( (signed int)uNumLevelDecorations > 0 )
+      {
+        v66 = &pLevelDecorations[0].field_2;
+        for (int i =  0; i <= (signed int)uNumLevelDecorations; ++i)
         {
-          v68 = &pLevelDecorations[0].field_2;
-          do
-          {
-            memcpy(v11, v68, 2u);
-            v68 += 16;
-            v11 = (char *)v11 + 2;
-            ++v70;
-          }
-          while ( v70 < (signed int)uNumLevelDecorations );
+          memcpy(v22, v66, 2);
+          v66 += 16;
+          v22 = (char *)v22 + 2;
         }
-        memcpy(v11, &uNumActors, 4u);
-        v12 = (char *)v11 + 4;
-        memcpy(v12, pActors, 836 * uNumActors);
-        v13 = (char *)v12 + 836 * uNumActors;
-        memcpy(v13, &uNumLayingItems, 4u);
-        v13 = (char *)v13 + 4;
-        memcpy(v13, pLayingItems, 112 * uNumLayingItems);
-        v14 = (char *)v13 + 112 * uNumLayingItems;
-        memcpy(v14, &uNumChests, 4u);
-        v14 = (char *)v14 + 4;
-        memcpy(v14, pChests, 5324 * uNumChests);
-        v15 = (char *)v14 + 5324 * uNumChests;
-        memcpy(v15, pIndoor->pDoors, 0x3E80u);
-        v15 = (char *)v15 + 16000;
-        memcpy(v15, pIndoor->ptr_0002B4_doors_ddata, pIndoor->blv.uDoors_ddata_Size);
-        v16 = (char *)v15 + pIndoor->blv.uDoors_ddata_Size;
-        memcpy(v16, &stru_5E4C90, 0xC8u);
-        v17 = (int)((char *)v16 + 200);
-        memcpy((void *)v17, &pIndoor->stru1, 0x38u);
       }
-      else
-      {
-        v18 = 0;
-        pOutdoor->ddm.uNumFacesInBModels = 0;
-        if ( (signed int)pOutdoor->uNumBModels > 0 )
-        {
-          v19 = pOutdoor->uNumBModels;
-          v20 = (char *)&pOutdoor->pBModels->uNumFaces;
-          do
-          {
-            v18 += *(int *)v20;
-            v20 += 188;
-            --v19;
-            pOutdoor->ddm.uNumFacesInBModels = v18;
-          }
-          while ( v19 );
-        }
-        v21 = DstBuf;
-        pOutdoor->ddm.uNumBModels = pOutdoor->uNumBModels;
-        pOutdoor->ddm.uNumDecorations = uNumLevelDecorations;
-        memcpy(DstBuf, &pOutdoor->ddm, 0x28u);
-        v21 = (char *)v21 + 40;
-        memcpy(v21, pOutdoor->array_528, 0x3C8u);
-        v21 = (char *)v21 + 968;
-        memcpy(v21, pOutdoor->array_8F0, 0x3C8u);
-        v22 = (char *)v21 + 968;
-        v70 = 0;
-        if ( (signed int)pOutdoor->uNumBModels > 0 )
-        {
-          v23 = pOutdoor->pBModels;
-          v24 = 76;
-          do
-          {
-            v25 = *(int *)&v23->pModelName[v24] == 0;
-            v26 = *(int *)&v23->pModelName[v24] < 0;
-            v66 = 0;
-            if ( !(v26 | v25) )
-            {
-              v68 = 0;
-              do
-              {
-                v38 = (char *)v68 + *(int *)&v23->pModelName[v24 + 8] + 28;
-                memcpy(v22, v38, 4u);
-                v23 = pOutdoor->pBModels;
-                v68 += 154;
-                v22 = (char *)v22 + 4;
-                v66 = (__int16 *)((char *)v66 + 1);
-              }
-              while ( (signed int)v66 < *(int *)&pOutdoor->pBModels->pModelName[v24] );
-            }
-            ++v70;
-            v24 += 188;
-          }
-          while ( v70 < (signed int)pOutdoor->uNumBModels );
-        }
-        v27 = 0;
-        if ( (signed int)uNumLevelDecorations > 0 )
-        {
-          v66 = &pLevelDecorations[0].field_2;
-          do
-          {
-            memcpy(v22, v66, 2u);
-            v66 += 16;
-            v22 = (char *)v22 + 2;
-            ++v27;
-          }
-          while ( v27 < (signed int)uNumLevelDecorations );
-        }
-        memcpy(v22, &uNumActors, 4u);
-        v28 = (char *)v22 + 4;
-        memcpy(v28, pActors, 836 * uNumActors);
-        v29 = (char *)v28 + 836 * uNumActors;
-        memcpy(v29, &uNumLayingItems, 4u);
-        v29 = (char *)v29 + 4;
-        memcpy(v29, pLayingItems, 112 * uNumLayingItems);
-        v30 = (char *)v29 + 112 * uNumLayingItems;
-        memcpy(v30, &uNumChests, 4u);
-        v30 = (char *)v30 + 4;
-        memcpy(v30, pChests, 5324 * uNumChests);
-        v31 = (char *)v30 + 5324 * uNumChests;
-        memcpy(v31, &stru_5E4C90, 0xC8u);
-        v17 = (int)((char *)v31 + 200);
-        memcpy((void *)v17, &pOutdoor->uLastVisitDay, 0x38u);
-        v9 = (int)v71;
-      }
-      v32 = v17 + 56;
-      strcpy(Source, pCurrentMapName);
-      _splitpath(Source, &Drive, &Dir, &Filename, &Ext);
-      v48 = 100;
-      Size = v32 - (int)DstBuf;
-      v69 = 999984;
-      LOBYTE(v33) = zlib::MemZip((char *)v9 + 16, (unsigned int *)&v69, DstBuf, v32 - (int)DstBuf);
-      if ( v33 || (signed int)v69 > (signed int)Size )
-      {
-        memcpy((void *)(v9 + 16), DstBuf, Size);
-        v69 = Size;
-      }
-      v69 += 16;
-      memcpy((void *)(v9 + 8), &v69, 4u);
-      memcpy((void *)(v9 + 12), &Size, 4u);
-      sprintfex(Source, "%s%s", &Filename, &Ext);
-      strcpy((char *)&pDir, Source);
-      pDir.uDataSize = v69;
-      if ( pNew_LOD->Write(&pDir, (const void *)v9, 0) )
-      {
-        v39 = 208;
-        sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 208);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1071", 0);
-      }
-      free((void *)v9);
+      memcpy(v22, &uNumActors, 4);
+      v28 = (char *)v22 + 4;
+      memcpy(v28, pActors, 836 * uNumActors);
+      v29 = (char *)v28 + 836 * uNumActors;
+      memcpy(v29, &uNumLayingItems, 4);
+      v29 = (char *)v29 + 4;
+      memcpy(v29, pLayingItems, 112 * uNumLayingItems);
+      v30 = (char *)v29 + 112 * uNumLayingItems;
+      memcpy(v30, &uNumChests, 4);
+      v30 = (char *)v30 + 4;
+      memcpy(v30, pChests, 5324 * uNumChests);
+      v31 = (char *)v30 + 5324 * uNumChests;
+      memcpy(v31, &stru_5E4C90, 0xC8);
+      v17 = (int)((char *)v31 + 200);
+      memcpy((void *)v17, &pOutdoor->uLastVisitDay, 0x38);
+      v9 = (int)v71;
+    }
+    v32 = v17 + 56;
+    strcpy(Source, pCurrentMapName);
+    _splitpath(Source, &Drive, &Dir, &Filename, &Ext);
+    v48 = 100;
+    Size = v32 - (int)DstBuf;
+    v69 = 999984;
+    LOBYTE(v33) = zlib::MemZip((char *)v9 + 16, (unsigned int *)&v69, DstBuf, v32 - (int)DstBuf);
+    if ( v33 || (signed int)v69 > (signed int)Size )
+    {
+      memcpy((void *)(v9 + 16), DstBuf, Size);
+      v69 = Size;
     }
-    free(DstBuf);
-    if ( a1 )
+    v69 += 16;
+    memcpy((void *)(v9 + 8), &v69, 4);
+    memcpy((void *)(v9 + 12), &Size, 4);
+    sprintf(Source, "%s%s", &Filename, &Ext);
+    strcpy((char *)&pDir, Source);
+    pDir.uDataSize = v69;
+    if ( pNew_LOD->Write(&pDir, (const void *)v9, 0) )
     {
-      if ( !CopyFileA("data\\new.lod", "saves\\autosave.mm7", 0) )
-      {
-        v34 = GetLastError();
-        FormatMessageA(0x1000u, 0, v34, 0x400u, &Buffer, 0x80u, 0);
-        v39 = 300;
-        sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 300);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1097", 0);
-      }
+      sprintf(Str, pGlobalTXT_LocalizationStrings[612], 208);
+      MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1071", 0);
     }
-    pParty->vPosition.x = v52;
-    pParty->vPosition.y = v51;
-    pParty->vPosition.z = v62;
-    pParty->uFallStartY = v62;
-    pParty->sRotationY = v53;
-    result = v54;
-    pParty->sRotationX = v54;
-
+    free((void *)v9);
+  }
+  free(DstBuf);
+  if ( a1 )
+  {
+    if ( !CopyFileA("data\\new.lod", "saves\\autosave.mm7", 0) )
+    {
+      v34 = GetLastError();
+      FormatMessageA(0x1000, 0, v34, 0x400, &Buffer, 0x80, 0);
+      sprintf(Str, pGlobalTXT_LocalizationStrings[612], 300);
+      MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1097", 0);
+    }
+  }
+  pParty->vPosition.x = pPositionX;
+  pParty->vPosition.y = v51;
+  pParty->vPosition.z = v62;
+  pParty->uFallStartY = v62;
+  pParty->sRotationY = v53;
+  result = v54;
+  pParty->sRotationX = v54;
   return result;
 }
 
@@ -678,7 +617,7 @@
     strcpy((char *)&pDir, "header.bin");
     pDir.uDataSize = 100;
     pNew_LOD->Write(&pDir, (char *)&pSavegameHeader + v2, 0);
-    sprintfex(pTmpBuf, "saves\\save%03d.mm7", v6);
+    sprintf(pTmpBuf, "saves\\save%03d.mm7", v6);
     pNew_LOD->CloseWriteFile();
     CopyFileA("data\\new.lod", pTmpBuf, 0);
   }
--- a/mm7_2.cpp	Wed Nov 07 20:23:04 2012 +0200
+++ b/mm7_2.cpp	Wed Nov 07 20:26:28 2012 +0200
@@ -11726,27 +11726,23 @@
 //----- (0046086A) --------------------------------------------------------
 bool Autosave()
 {
-  int v0; // esi@3
-  int v1; // eax@4
-  int v2; // edx@5
+  int flag; // esi@3
   FILE *v3; // eax@7
   LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3
   LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4
   LOD::Directory v7; // [sp+12Ch] [bp-4Ch]@9
   LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3
-  unsigned int v9; // [sp+16Ch] [bp-Ch]@5
   void *pSave; // [sp+170h] [bp-8h]@3
-  unsigned int v11; // [sp+174h] [bp-4h]@5
 
   if ( pVideoPlayer->AnyMovieLoaded() )
     pVideoPlayer->Unload();
-  v0 = 0;
+  flag = 0;
   pSave = pAllocator->AllocNamedChunk(0, 0xF4240, 0);
   pNew_LOD->CloseWriteFile();
   remove("data\\new.lod");
   this_.Reset();
-  strcpy(this_.array_000004, "MMVII");
-  strcpy(this_.array_000054, "newmaps for MMVII");
+  strcpy(this_.LodVersion, "MMVII");
+  strcpy(this_.LodDescription, "newmaps for MMVII");
   this_.dword_0000A4 = 100;
   this_.dword_0000A8 = 0;
   a3.dword_000018 = 0;
@@ -11758,48 +11754,35 @@
     pNew_LOD->CreateTempFile();
     pNew_LOD->uNumSubIndices = 0;
     pDir.Reset();
-    v1 = (signed int)pGames_LOD->uNumSubIndices / 2;
-    if ( (signed int)pGames_LOD->uNumSubIndices / 2 < (signed int)pGames_LOD->uNumSubIndices )
-    {
-      v2 = 32 * v1;
-      v11 = 32 * v1;
-      v9 = pGames_LOD->uNumSubIndices - v1;
-      while ( 1 )
-      {
-        memcpy(&pDir, (char *)pGames_LOD->pSubIndices + v2, sizeof(pDir));
-        v3 = pGames_LOD->FindContainer((const char *)pGames_LOD->pSubIndices + v2, 1);
-        fread(pSave, pGames_LOD->pSubIndices[v11 / 0x20].uDataSize, 1u, v3);
-        pNew_LOD->AppendDirectory(&pDir, pSave);
-        v11 += 32;
-        --v9;
-        if ( !v9 )
-          break;
-        v2 = v11;
-      }
-      v0 = 0;
-    }
+	for (int i =  pGames_LOD->uNumSubIndices / 2; i < pGames_LOD->uNumSubIndices; ++i)
+   {
+    memcpy(&pDir, (char *)&pGames_LOD->pSubIndices[i], sizeof(pDir));
+    v3 = pGames_LOD->FindContainer((const char *)&pGames_LOD->pSubIndices[i], 1);
+    fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1, v3);
+    pNew_LOD->AppendDirectory(&pDir, pSave);
+   }
     v7.Reset();
     strcpy(pSavegameHeader->pLocationName, "out01.odm");
     strcpy((char *)&v7, "header.bin");
     v7.uDataSize = 100;
     pNew_LOD->AppendDirectory(&v7, &pSavegameHeader);
     pNew_LOD->Save();
-    pParty->vPrevPosition.y = v0;
+    pParty->vPrevPosition.y = 0;
     pParty->vPrevPosition.x = 12552;
     pParty->vPosition.x = 12552;
-    pParty->vPosition.z = v0;
-    pParty->uFallStartY = v0;
-    pParty->sPrevRotationX = v0;
-    pParty->sRotationX = v0;
+    pParty->vPosition.z = 0;
+    pParty->uFallStartY = 0;
+    pParty->sPrevRotationX = 0;
+    pParty->sRotationX = 0;
     pParty->vPrevPosition.z = 1816;
     pParty->vPosition.y = 1816;
-    v0 = 1;
+    flag = 1;
     pParty->sPrevRotationY = 512;
     pParty->sRotationY = 512;
     SaveGame(1, (__int16 *)1);
   }
   pAllocator->FreeChunk(pSave);
-  return v0;
+  return flag;
 }
 
 
--- a/mm7_3.cpp	Wed Nov 07 20:23:04 2012 +0200
+++ b/mm7_3.cpp	Wed Nov 07 20:26:28 2012 +0200
@@ -15221,7 +15221,7 @@
   memset(&DstBuf, 0, 0x48u);
   if ( (signed int)v5 >= (signed int)uBufferSize )
   {
-    sprintfex(&Args, "File %s Size %lu - Buffer size %lu", v3, v5, uBufferSize);
+    sprintf(&Args, "File %s Size %lu - Buffer size %lu", v3, v5, uBufferSize);
     Abortf(&Args);
   }
   memcpy(Dst, ptr, v5);
@@ -15298,7 +15298,7 @@
   uLevelStrNumStrings = (signed __int16)v2 - 1;
   if ( v0 > 800 )
   {
-    sprintfex(Args, "MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", v0 + 1);
+    sprintf(Args, "MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", v0 + 1);
     Abortf(Args);
   }
   v6 = 0;
@@ -15824,7 +15824,7 @@
   {
     if ( v10 )
     {
-      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[409], v0->pName);// "Do you wish to leave %s?"
+      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[409], v0->pName);// "Do you wish to leave %s?"
       v1 = pTmpBuf;
       goto LABEL_12;
     }
@@ -15857,7 +15857,7 @@
 
   pEventTimer->Pause();
   v0 = const_2();
-  sprintfex(pContainer, "evt%02d", v0);
+  sprintf(pContainer, "evt%02d", v0);
   if ( pParty->uAlignment )
   {
     if ( pParty->uAlignment != 2 )
@@ -15874,7 +15874,7 @@
   pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("outside", TEXTURE_16BIT_PALETTE)];
   v1 = pMapStats->GetMapInfo(pCurrentMapName);
   if ( v1 )
-    sprintfex(byte_591098, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
+    sprintf(byte_591098, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
   else
     strcpy(byte_591098, pGlobalTXT_LocalizationStrings[79]);// "Exit"
   result = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)17, 0, (int)byte_591098);
@@ -15950,9 +15950,9 @@
       v6 = v3;
       v5 = pGlobalTXT_LocalizationStrings[128]; // "It will take %d days to travel to %s."
     }
-    sprintfex(pTmpBuf, v5, v6, v1->pName);
+    sprintf(pTmpBuf, v5, v6, v1->pName);
     strcat(pTmpBuf, "\n \n");
-    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName);
+    sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName);
     strcat(pTmpBuf, pTmpBuf2);
     v4 = pFontCreate->CalcTextHeight(pTmpBuf, &v7, 0, 0);
     v7.DrawText2(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf, 3u);
@@ -16012,7 +16012,7 @@
   }
   if ( pGUIWindow2->ptr_1C == (void *)26 )
   {
-    sprintfex(Str, "%s %s", GameUI_StatusBar_TimedString, pKeyActionMap->pPressedKeysBuffer);
+    sprintf(Str, "%s %s", GameUI_StatusBar_TimedString, pKeyActionMap->pPressedKeysBuffer);
     v3 = pFontLucida->GetLineWidth(Str);
     pGUIWindow2->DrawText(pFontLucida, 13, 357, 0, Str, 0, 0, 0);
     pGUIWindow2->DrawFlashingInputCursor(v3 + 13, 357, pFontLucida);
@@ -16173,7 +16173,7 @@
   if ( v3 )
   {
     v4 = pTmpBuf;
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v0->pName, aNPCProfessionNames[v3]);
+    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v0->pName, aNPCProfessionNames[v3]);
   }
   else
   {
@@ -16191,7 +16191,7 @@
     }
     if ( uDialogueType == 91 )
     {
-      sprintfex(v4, pGlobalTXT_LocalizationStrings[576], dword_F8B1B4);// "Congratulations on your win: here's your stuff: %u gold."
+      sprintf(v4, pGlobalTXT_LocalizationStrings[576], dword_F8B1B4);// "Congratulations on your win: here's your stuff: %u gold."
       pInString = v4;
       v8 = 0;
       goto LABEL_39;
@@ -16356,7 +16356,7 @@
         if ( v0->uFlags & 0x80 )
         {
 LABEL_59:
-          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[408], v0->pName);
+          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], v0->pName);
           v24 = pTmpBuf;
           goto LABEL_79;
         }
@@ -19443,7 +19443,7 @@
   while ( v4 < 200 );
   if ( v4 >= 200 )
   {
-    sprintfex(&Args, "Unable to find Door ID: %i!", uDoorID);
+    sprintf(&Args, "Unable to find Door ID: %i!", uDoorID);
     Abortf(&Args);
   }
   v6 = &pIndoor->pDoors[v4];
--- a/mm7_4.cpp	Wed Nov 07 20:23:04 2012 +0200
+++ b/mm7_4.cpp	Wed Nov 07 20:26:28 2012 +0200
@@ -2943,7 +2943,7 @@
   do
   {
     v5 = result + 1;
-    sprintfex(pTmpBuf, "%s%02d", *v3, result + 1);
+    sprintf(pTmpBuf, "%s%02d", *v3, result + 1);
     pIcons_LOD->ReloadTexture(*v4, pTmpBuf, 2);
     result = v5;
     ++v4;
@@ -5126,7 +5126,7 @@
         if ( v16 + 10 * (unsigned __int8)*v15 == 552 )
         {
           v46 = v13->GetDisplayName();
-          sprintfex(a1, format_4E2D80, v59, v46);
+          sprintf(a1, format_4E2D80, v59, v46);
 LABEL_117:
           v11 = a1;
           goto LABEL_118;
@@ -5172,7 +5172,7 @@
 LABEL_108:
           strncpy(a1, v15, 2u);
           v51 = atoi(a1);
-          sprintfex(a1, "%lu", v51);
+          sprintf(a1, "%lu", v51);
           goto LABEL_117;
         }
         v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
@@ -5216,7 +5216,7 @@
             }
           }
 LABEL_98:
-          sprintfex(a1, "%lu", v29);
+          sprintf(a1, "%lu", v29);
           goto LABEL_117;
         }
         v34 = *v26;
@@ -5252,7 +5252,7 @@
             v53 = v56.field_C + 1;
             v50 = v56.field_14;
 LABEL_116:
-            sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
+            sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
             goto LABEL_117;
           }
           v52 = pPlayers[4];
@@ -5847,32 +5847,8 @@
     ++uControlParama;
   }
   while ( (signed int)uXa < 640 );
-  pCreationUI_BtnPressLeft[0] = pGUIWindow_CurrentMenu->CreateButton(
-                                  10u,
-                                  32u,
-                                  11u,
-                                  13u,
-                                  1,
-                                  0,
-                                  0xABu,
-                                  0,
-                                  0,
-                                  "",
-                                  pTexture_presleft,
-                                  0);
-  pCreationUI_BtnPressLeft[1] = pGUIWindow_CurrentMenu->CreateButton(
-                                  169u,
-                                  32u,
-                                  11u,
-                                  13u,
-                                  1,
-                                  0,
-                                  0xABu,
-                                  1u,
-                                  0,
-                                  "",
-                                  pTexture_presleft,
-                                  0);
+  pCreationUI_BtnPressLeft[0] = pGUIWindow_CurrentMenu->CreateButton(10u, 32u, 11u, 13u, 1, 0, 0xABu, 0, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft[1] = pGUIWindow_CurrentMenu->CreateButton(169u, 32u, 11u, 13u, 1, 0, 0xABu, 1u, 0, "", pTexture_presleft, 0);
   pCreationUI_BtnPressLeft[2] = pGUIWindow_CurrentMenu->CreateButton(
                                   327u,
                                   32u,
@@ -9516,7 +9492,7 @@
   v1 = *_this - 399;
   v2 = (*_this - 400) % 11 + 1;
   v11 = 4 * (*_this - 400) / 11;
-  sprintfex(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2);
+  sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2);
   if ( pMouse->GetCursorPos(&a2)->y <= 320 )
     v3 = pMouse->GetCursorPos(&a2)->y + 30;
   else
@@ -9539,7 +9515,7 @@
     v5 = v13;
   if ( v4 > v5 )
     v5 = v4;
-  sprintfex(
+  sprintf(
     pTmpBuf2,
     "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
     pSpellStats->pInfos[v1].pDescription,
@@ -9576,7 +9552,7 @@
   a1.uFrameZ = a1.uFrameX + 107;
   a1.uFrameWidth = 108;
   a1.DrawText2(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u);
-  sprintfex(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
+  sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
   return a1.DrawText2(
            pFontComic,
            0xCu,
@@ -9609,7 +9585,7 @@
     v4.uFrameX = 483;
     v4.uFrameWidth = 148;
     v4.uFrameZ = 334;
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// 
+    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// 
                                                 // "%s is in no condition to %s"
                                                 // "do anything"
     v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
@@ -10336,7 +10312,7 @@
       {
         if ( v31 == v14 )
         {
-          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);
+          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);
           return pTmpBuf;
         }
         v25 = pClassNames[v10 + 2];
@@ -10354,7 +10330,7 @@
     }
     v22 = pGlobalTXT_LocalizationStrings[633];
 LABEL_23:
-    sprintfex(pTmpBuf, v22, v25);
+    sprintf(pTmpBuf, v22, v25);
     return pTmpBuf;
   }
   if ( !v1->CanAct() )
@@ -10553,7 +10529,7 @@
     v24 = pSkillNames[v17];
     v21 = pGlobalTXT_LocalizationStrings[225];
 LABEL_90:
-    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27);
+    sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27);
   }
   return pTmpBuf2;
 }
@@ -10678,7 +10654,7 @@
     v2 = (&off_4EB080)[4 * uHouse_ExitPic];
     if ( !v2 )
     {
-      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0);
+      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0);
       v2 = pTmpBuf;
     }
     v3 = v2;
@@ -10694,7 +10670,7 @@
   v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u);
   v8 = v6->uProfession;
   if ( v8 )
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]);
+    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]);
   else
     strcpy(pTmpBuf, v6->pName);
   a1.DrawText2(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u);
@@ -10773,8 +10749,8 @@
           v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
           v31 = *(int *)v29;
           v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
-          sprintfex(pTmpBuf, &byte_4F0F98, v32, v31, v30);
-          sprintfex(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]);
+          sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30);
+          sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]);
           ptr_F8B1E8 = pTmpBuf2;
           v15 = "";
           goto LABEL_45;
@@ -10816,8 +10792,8 @@
             }
             if ( uDialogueType != 84 )
               goto LABEL_49;
-            sprintfex(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[dword_F8B1A8].pUnidentifiedName);
-            sprintfex(pTmpBuf2, ptr_F8B1E8, pTmpBuf);
+            sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[dword_F8B1A8].pUnidentifiedName);
+            sprintf(pTmpBuf2, ptr_F8B1E8, pTmpBuf);
             ptr_F8B1E8 = pTmpBuf2;
             goto LABEL_45;
           }
@@ -11803,7 +11779,7 @@
   {
     pDialogueWindow->Release();
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
-    sprintfex(byte_591098, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);
+    sprintf(byte_591098, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);
     ptr_5076F4 = pDialogueWindow->CreateButton(
                    0x236u,
                    0x1BDu,
@@ -12197,7 +12173,7 @@
             while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem );
             if ( v72 )
             {
-              sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
+              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
               v65.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
               v73 = (signed int)(149 - i) / v72;
               if ( v73 > 32 )
@@ -12247,7 +12223,7 @@
             else
             {
 LABEL_76:
-              sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->uClass]);// 
+              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->uClass]);// 
                                                 // "Seek knowledge elsewhere %s the %s"
               strcat(pTmpBuf, "\n \n");
               strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
@@ -12305,7 +12281,7 @@
                 pOutdoor->SetFog();
             }
             v0->PlaySound(87, 0);
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// 
+            sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// 
                                                 // "%s is now Level %lu and has earned %lu Skill Points!"
             ShowStatusBarString(pTmpBuf, 2u);
             goto LABEL_56;
@@ -12326,7 +12302,7 @@
           }
           return result;
         }
-        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], v5 - LODWORD(v0->uExperience), v34 + 1);// 
+        sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[538], v5 - LODWORD(v0->uExperience), v34 + 1);// 
                                                 // "You need %d more experience to train to level %d"
         v35 = 0;
         v62 = 3;
@@ -12336,7 +12312,7 @@
       }
       else
       {
-        sprintfex(pTmpBuf, "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// 
+        sprintf(pTmpBuf, "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// 
                                                 // ""With your skills, you should be working here as a teacher.""
                                                 // ""Sorry, but we are unable to train you.""
         v35 = 0;
@@ -12387,7 +12363,7 @@
               v61 = pGlobalTXT_LocalizationStrings[536];// ""With your skills, you should be working here as a teacher.""
               v59 = "%s\n \n%s";
             }
-            sprintfex(*v45, v59, v61, v64);
+            sprintf(*v45, v59, v61, v64);
           }
           v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0);
           v43 = pDialogueWindow;
@@ -12669,7 +12645,7 @@
           if ( !v122 )
           {
 LABEL_140:
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]);// 
+            sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]);// 
                                                 // "Seek knowledge elsewhere %s the %s"
             strcat(pTmpBuf, "\n \n");
             strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
@@ -12682,7 +12658,7 @@
             v88 = &v112;
             goto LABEL_61;
           }
-          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
+          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
           v112.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
           v119 = (const char **)((149 - v118) / v122);
           if ( (149 - v118) / v122 > 32 )
@@ -13538,7 +13514,7 @@
         v3 = (int)(&v1->uIntelligence + dword_F8B19C);
         if ( *(short *)v3 )
         {
-          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dword_F8B19C + 20]);
+          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dword_F8B19C + 20]);
           ShowStatusBarString(pTmpBuf, 2u);
           pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
         }
@@ -13710,7 +13686,7 @@
   if ( !v61 )
   {
 LABEL_64:
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->uClass]);
+    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->uClass]);
     strcat(pTmpBuf, "\n \n");
     strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
     v18 = pTmpBuf;
@@ -13724,7 +13700,7 @@
   }
   if ( Str )
   {
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63);
+    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63);
     v52.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
   }
   v63 = (signed int)(149 - v62) / v61;
@@ -13914,7 +13890,7 @@
             while ( (signed int)v62 < v4->pNumPresenceButton + v11 );
             if ( v65 )
             {
-              sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64);
+              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64);
               v57.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
               v64 = (149 - (signed int)v66) / (signed int)v65;
               if ( v64 > 32 )
@@ -13966,7 +13942,7 @@
             else
             {
 LABEL_78:
-              sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->uClass]);
+              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->uClass]);
               strcat(pTmpBuf, "\n \n");
               strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
               v22 = WORD2(v59);
@@ -14120,7 +14096,7 @@
   v41->uY = 0;
   if ( v1->_4B6FF9() )
   {
-    sprintfex(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]);
+    sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]);
     v63 = 0;
   }
   strcpy(&Dest, pGlobalTXT_LocalizationStrings[68]);
@@ -14415,14 +14391,14 @@
   if ( !v34 )
   {
 LABEL_40:
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->uClass]);
+    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->uClass]);
     strcat(pTmpBuf, "\n \n");
     strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
     v22 = v31;
     v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0);
     return (int)v28.DrawText2(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
   }
-  sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32);
+  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32);
   v28.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
   v32 = (149 - v33) / v34;
   if ( (149 - v33) / v34 > 32 )
@@ -14577,7 +14553,7 @@
       v59 = pDialogueWindow;
       v54 = v17;
       strcpy(&Dest, "");
-      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1);
+      sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1);
       v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0);
       v19 = v16->pNumPresenceButton;
       v20 = v18 + v17 + 146;
@@ -14608,7 +14584,7 @@
           if ( pDialogueWindow->pCurrentPosActiveItem != s1 )
             v27 = *(const char **)v57;
           v47[1] = v27;
-          sprintfex(a1, format_4E2DC8, v27);
+          sprintf(a1, format_4E2DC8, v27);
           v66 = (unsigned __int8)byte_4F09B8[v26 * 4];
           if ( (signed int)ptr_507BC0->ptr_1C >= 63 )
           {
@@ -14631,7 +14607,7 @@
           if ( v61 != (Player *)v2 )
           {
             memcpy(&v32, (char *)&pMapStats + 68 * (unsigned __int8)byte_4F09B0[v26 * 4], 0x44u);
-            sprintfex(
+            sprintf(
               pTmpBuf,
               pGlobalTXT_LocalizationStrings[404],
               v66,
@@ -14693,7 +14669,7 @@
         v45 = (unsigned int)&v49;
         v44 = &v48;
         v43 = pTmpBuf2;
-        sprintfex(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, &v48, &v49, &v50, &v51, &Dest);
+        sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, &v48, &v49, &v50, &v51, &Dest);
         v53.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
       }
       else
@@ -15382,7 +15358,7 @@
   pEventTimer->Pause();
   pAudioPlayer->StopChannels(-1, -1);
   v11 = const_2();
-  sprintfex(pContainer, "evt%02d", v11);
+  sprintf(pContainer, "evt%02d", v11);
   if ( pParty->uAlignment )
   {
     if ( pParty->uAlignment != 2 )
@@ -15415,7 +15391,7 @@
         v20 = pMapStats->pInfos[v14].pName;
         v18 = pGlobalTXT_LocalizationStrings[410];
 LABEL_10:
-        sprintfex(byte_591098, v18, v20);
+        sprintf(byte_591098, v18, v20);
         goto LABEL_20;
       }
       v21 = pGlobalTXT_LocalizationStrings[79];
@@ -15538,7 +15514,7 @@
     do
     {
       v8 = v19;
-      sprintfex(pContainer, "npc%03u", Dst[v19]);
+      sprintf(pContainer, "npc%03u", Dst[v19]);
       v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
       ++v19;
       pDialogueNPCPortraits[v8] = &pIcons_LOD->pTextures[v9];
@@ -15644,7 +15620,7 @@
         v9 -= 12;
         v8 = 1;
       }
-      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[414], v6, aAMPMNames[v7], v9, aAMPMNames[v8]);
+      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], v6, aAMPMNames[v7], v9, aAMPMNames[v8]);
       ShowStatusBarString(pTmpBuf, 2u);
       if ( uActiveCharacter )
         pPlayers[uActiveCharacter]->PlaySound(3, 0);
@@ -15701,7 +15677,7 @@
     if ( !pIcons_LOD->uNumPrevLoadedFiles )
       pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
     v16 = const_2();
-    sprintfex(pContainer, "evt%02d", v16);
+    sprintf(pContainer, "evt%02d", v16);
     if ( pParty->uAlignment )
     {
       if ( pParty->uAlignment != 2 )