changeset 2176:2f9689a85c31

Слияние
author Ritor1
date Tue, 21 Jan 2014 18:32:43 +0600
parents 5261002b7d39 (current diff) 5ca3251ea543 (diff)
children e1199b655710
files LOD.cpp
diffstat 3 files changed, 46 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/SaveLoad.cpp	Tue Jan 21 18:32:23 2014 +0600
+++ b/SaveLoad.cpp	Tue Jan 21 18:32:43 2014 +0600
@@ -25,24 +25,12 @@
 #include "mm7_data.h"
 
 
-
-
-
 struct SavegameList *pSavegameList = new SavegameList;
 unsigned int uNumSavegameFiles;
 std::array<unsigned int, 45> pSavegameUsedSlots;
 std::array<struct RGBTexture, 45> pSavegameThumbnails;
 std::array<SavegameHeader, 45> pSavegameHeader;
 
-
-
-
-
-
-
-
-
-
 //----- (0045EE8A) --------------------------------------------------------
 void __fastcall LoadGame(unsigned int uSlot)
 {
@@ -68,7 +56,6 @@
       remove(pTmpBuf.data());
     }
 
-
   if (SoundSetAction[24][0])
     for (uint i = 0; i < 4; ++i)
     {
@@ -161,7 +148,6 @@
     Log::Warning(L"NPCStats: deserialization warning");
   fread(pNPCStats->pGroups_copy, sizeof(pNPCStats->pGroups_copy), 1, file);
 
-
   uActiveCharacter = 0;
   for (uint i = 0; i < 4; ++i)
     if (pParty->pPlayers[i].CanAct())
@@ -224,11 +210,9 @@
   viewparams->bRedrawGameUI = true;
 }
 
-
 //----- (0045F469) --------------------------------------------------------
 void SaveGame( bool IsAutoSAve, bool NotSaveWorld )
 {
-  //unsigned short *pScreenshot; // edi@5
   int text_pos; // eax@6
   FILE *pLLoidFile; // edi@24
   char* compressed_buf; // edi@30
@@ -278,7 +262,7 @@
   else
     pOutdoor->loc_time.uLastVisitDay = pParty->uTimePlayed;
 
-  pRenderer->PackScreenshot(150, 112, uncompressed_buff, 1000000, &pLodDirectory.uDataSize);
+  pRenderer->PackScreenshot(150, 112, uncompressed_buff, 1000000, &pLodDirectory.uDataSize);// 
   strcpy(pLodDirectory.pFilename, "image.pcx");
 
   if (pCurrentScreen == SCREEN_SAVEGAME)
@@ -398,19 +382,17 @@
       data_write_pos += sizeof(DDM_DLV_Header);
       memcpy(data_write_pos, pIndoor->_visible_outlines, 0x36B);
       data_write_pos += 875;
-    
-        for (int i =  0; i <(signed int)pIndoor->uNumFaces; ++i)
-        {
-          memcpy(data_write_pos, &pIndoor->pFaces[i].uAttributes, 4);
-          data_write_pos += 4;
-        }
+      for (int i =  0; i <(signed int)pIndoor->uNumFaces; ++i)
+      {
+        memcpy(data_write_pos, &pIndoor->pFaces[i].uAttributes, 4);
+        data_write_pos += 4;
+      }
 
-        for (int i =  0; i <(signed int)uNumLevelDecorations; ++i)
-        {
-          memcpy(data_write_pos, &pLevelDecorations[i].uFlags, 2);
-     
-          data_write_pos+= 2;
-        }
+      for (int i =  0; i <(signed int)uNumLevelDecorations; ++i)
+      {
+        memcpy(data_write_pos, &pLevelDecorations[i].uFlags, 2);
+        data_write_pos += 2;
+      }
       memcpy(data_write_pos, &uNumActors, 4);
       data_write_pos += 4;
       memcpy(data_write_pos, &pActors, uNumActors * sizeof(Actor));
@@ -433,13 +415,11 @@
       data_write_pos += 56;
 
     }
-    else
+    else//for Outdoor
     {
       pOutdoor->ddm.uNumFacesInBModels = 0;
-      for (int i=0; i<pOutdoor->uNumBModels;++i)
-          {
-          pOutdoor->ddm.uNumFacesInBModels +=pOutdoor->pBModels[i].uNumFaces;
-          }
+      for ( int i = 0; i < pOutdoor->uNumBModels; ++i )
+        pOutdoor->ddm.uNumFacesInBModels += pOutdoor->pBModels[i].uNumFaces;
       pOutdoor->ddm.uNumBModels = pOutdoor->uNumBModels;
       pOutdoor->ddm.uNumDecorations = uNumLevelDecorations;
       memcpy(data_write_pos, &pOutdoor->ddm, sizeof(DDM_DLV_Header));//0x28
@@ -448,18 +428,18 @@
       data_write_pos += 968;
       memcpy(data_write_pos, pOutdoor->uDicovered_area, 0x3C8);
       data_write_pos += 968;
-		for (int i =  0; i < pOutdoor->uNumBModels ; ++i)  
-			for (int j =  0; j < pOutdoor->pBModels[i].uNumFaces;++j)//*(int *)&pOutdoor->pBModels->pModelName[v24]; ++j)
-            {		 
-              memcpy(data_write_pos, &(pOutdoor->pBModels[i].pFaces[j].uAttributes), 4);
-              data_write_pos += 4;
-            }
-      
-        for (int i = 0; i < (signed int)uNumLevelDecorations; ++i)
+      for (int i =  0; i < pOutdoor->uNumBModels ; ++i)  
+        for (int j =  0; j < pOutdoor->pBModels[i].uNumFaces;++j)//*(int *)&pOutdoor->pBModels->pModelName[v24]; ++j)
         {
-          memcpy(data_write_pos, &pLevelDecorations[i].uFlags, 2);
-          data_write_pos += 2;
+          memcpy(data_write_pos, &(pOutdoor->pBModels[i].pFaces[j].uAttributes), 4);
+          data_write_pos += 4;
         }
+
+      for (int i = 0; i < (signed int)uNumLevelDecorations; ++i)
+      {
+        memcpy(data_write_pos, &pLevelDecorations[i].uFlags, 2);
+        data_write_pos += 2;
+      }
       memcpy(data_write_pos, &uNumActors, 4);
       data_write_pos += 4;
       memcpy(data_write_pos, pActors.data(), 836 * uNumActors);
@@ -519,34 +499,21 @@
   pParty->sRotationX = sPRotationX;
 }
 
-
 //----- (00460078) --------------------------------------------------------
 void __fastcall DoSavegame(unsigned int uSlot)
 {
-  //unsigned int v1; // esi@1
-  //int v2; // esi@2
-  //RGBTexture *v3; // ebx@3
-  int bNotArena; // [sp+2Ch] [bp-8h]@1
-  //unsigned int v6; // [sp+30h] [bp-4h]@1
-
-  //__debugbreak();
-
-  //v1 = uSlot;
-  //v6 = uSlot;
-  bNotArena = _stricmp(pCurrentMapName, "d05.blv");
-  if ( bNotArena )
+  if ( _stricmp(pCurrentMapName, "d05.blv") )//Not Arena( )
   {
     LOD::Directory pDir; // [sp+Ch] [bp-28h]@2
     SaveGame(0, 0);
-    //v2 = 100 * v1;
-    strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName);
-    pSavegameHeader[uSlot].uWordTime = pParty->uTimePlayed;
+    strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName);//  
+    pSavegameHeader[uSlot].uWordTime = pParty->uTimePlayed;// 
     strcpy(pDir.pFilename, "header.bin");
     pDir.uDataSize = 100;
     pNew_LOD->Write(&pDir, &pSavegameHeader[uSlot], 0);
     sprintf(pTmpBuf.data(), "saves\\save%03d.mm7", uSlot);
-    pNew_LOD->CloseWriteFile();
-    CopyFileA("data\\new.lod", pTmpBuf.data(), 0);
+    pNew_LOD->CloseWriteFile();// 
+    CopyFileA("data\\new.lod", pTmpBuf.data(), 0);//    saves
   }
   GUI_UpdateWindows();
   pGUIWindow_CurrentMenu->Release();
@@ -556,7 +523,7 @@
   for (uint i = 0; i < 45; i++)
     pSavegameThumbnails[i].Release();
 
-  if ( bNotArena )
+  if ( _stricmp(pCurrentMapName, "d05.blv") )
     pNew_LOD->_4621A7();
   else
     ShowStatusBarString(pGlobalTXT_LocalizationStrings[583], 2);// "No saving in the Arena"
@@ -608,37 +575,37 @@
 //----- (0046086A) --------------------------------------------------------
 void SaveNewGame()
 {
-  FILE *v3; // eax@7
+  FILE *file; // eax@7
   void *pSave; // [sp+170h] [bp-8h]@3
 
   if ( pVideoPlayer->AnyMovieLoaded() )
     pVideoPlayer->Unload();
   pSave = malloc(1000000);
   pNew_LOD->CloseWriteFile();
-  remove("data\\new.lod");
+  remove("data\\new.lod");// new.lod
 
-  LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3
-  strcpy(this_.LodVersion, "MMVII");
-  strcpy(this_.LodDescription, "newmaps for MMVII");
-  this_.LODSize = 100;
-  this_.dword_0000A8 = 0;
+  LOD::FileHeader header; // [sp+Ch] [bp-16Ch]@3 
+  strcpy(header.LodVersion, "MMVII");
+  strcpy(header.LodDescription, "newmaps for MMVII");
+  header.LODSize = 100;
+  header.dword_0000A8 = 0;
 
   LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3
   a3.dword_000018 = 0;
   a3.word_00001E = 0;
   strcpy(a3.pFilename, "current");
-  pNew_LOD->CreateNewLod(&this_, &a3, "data\\new.lod");
-  if (pNew_LOD->LoadFile("data\\new.lod", false))
+  pNew_LOD->CreateNewLod(&header, &a3, "data\\new.lod");// new.lod  
+  if (pNew_LOD->LoadFile("data\\new.lod", false))//  new.lod(isFileOpened = true)
   {
-    pNew_LOD->CreateTempFile();
+    pNew_LOD->CreateTempFile();//   OutputFileHandle
     pNew_LOD->uNumSubDirs = 0;
 
     LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4
-    for (int i = pGames_LOD->uNumSubDirs / 2; i < pGames_LOD->uNumSubDirs; ++i)
+    for (int i = pGames_LOD->uNumSubDirs / 2; i < pGames_LOD->uNumSubDirs; ++i)//   76  151
     {
-      memcpy(&pDir, &pGames_LOD->pSubIndices[i], sizeof(pDir));
-      v3 = pGames_LOD->FindContainer(pGames_LOD->pSubIndices[i].pFilename, 1);
-      fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1, v3);
+      memcpy(&pDir, &pGames_LOD->pSubIndices[i], sizeof(pDir));//    pDir
+      file = pGames_LOD->FindContainer(pGames_LOD->pSubIndices[i].pFilename, 1);
+      fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1, file);
       pNew_LOD->AppendDirectory(&pDir, pSave);
     }
 
--- a/UI/UISaveLoad.cpp	Tue Jan 21 18:32:23 2014 +0600
+++ b/UI/UISaveLoad.cpp	Tue Jan 21 18:32:43 2014 +0600
@@ -253,8 +253,8 @@
   ++pIcons_LOD->uTexturePacksCount;
   if ( !pIcons_LOD->uNumPrevLoadedFiles )
     pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-  memset(pSavegameUsedSlots.data(), 0, 0xB4u);
-  memset(&pSavegameThumbnails, 0, 0x708u);
+  memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots));
+  memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails));
   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);
--- a/mm7_3.cpp	Tue Jan 21 18:32:23 2014 +0600
+++ b/mm7_3.cpp	Tue Jan 21 18:32:43 2014 +0600
@@ -4307,7 +4307,6 @@
   }
 }
 
-
 //----- (0044987B) --------------------------------------------------------
 void Transition_StopSound_Autosave(const char *pMapName, MapStartPoint start_point)
 {