changeset 2165:47ac9e87690c

isFileOpened
author Ritor1
date Thu, 16 Jan 2014 17:34:48 +0600
parents f5e9ac04dd25
children 00bd098f6435 1497ca65a525
files Indoor.cpp LOD.cpp LOD.h Outdoor.cpp
diffstat 4 files changed, 13 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.cpp	Thu Jan 16 00:08:27 2014 +0600
+++ b/Indoor.cpp	Thu Jan 16 17:34:48 2014 +0600
@@ -1892,7 +1892,7 @@
 
   void *pRawDLV = nullptr;
   strcpy(&pFilename[strlen(pFilename) - 4], ".dlv");
-  File = pNew_LOD->FindContainer(pFilename, 1);
+  File = pNew_LOD->FindContainer(pFilename, 1);//error on D28.dlv
   fread(&header, 0x10u, 1, File);//(FILE *)v245);
   bool _v244 = false;
   if (header.uVersion != 91969 ||
--- a/LOD.cpp	Thu Jan 16 00:08:27 2014 +0600
+++ b/LOD.cpp	Thu Jan 16 17:34:48 2014 +0600
@@ -946,7 +946,7 @@
     pSubIndices = NULL;
     pRoot = NULL;
     fclose(pFile);
-    isFileOpened = 0;
+    isFileOpened = false;
     _6A0CA8_lod_unused = 0;
   }
 }
@@ -1517,7 +1517,7 @@
     //insert new data in sorted index lod file
     bRewrite_data = false;
     insert_index=-1;
-    if (!isFileOpened)
+    if (!isFileOpened)//sometimes gives crash
         return 1;
     if ( !pSubIndices)
         return 2;
@@ -1666,7 +1666,7 @@
   else
     pFile = fopen(pFilename, "rb+");
   if (!pFile)
-    return false;
+    return false;//начало ошибки в сохранении на data\new.lod
 
   strcpy(pLODName, pFilename);
   fread(&header, sizeof(LOD::FileHeader), 1, pFile);
@@ -1778,7 +1778,7 @@
     {
       fread(pRoot, sizeof(LOD::Directory), header.uNumIndices, pFile);
       fseek(pFile, 0, SEEK_SET);
-      isFileOpened = 1;
+      isFileOpened = true;
       return false;
     }
     else
@@ -1810,16 +1810,13 @@
   pRoot(nullptr),
   isFileOpened(false)
 {
-  LOD::File *v1; // esi@1
-
   memset(pLODName, 0, 256);
   memset(pContainerName, 0, 16);
-  v1 = this;
-  v1->pFile = 0;
-  v1->pSubIndices = 0;
-  v1->pIOBuffer = 0;
-  v1->isFileOpened = 0;
-  v1->uIOBufferSize = 0;
+  this->pFile = 0;
+  this->pSubIndices = 0;
+  this->pIOBuffer = 0;
+  this->isFileOpened = false;
+  this->uIOBufferSize = 0;
   Close();
 }
 
--- a/LOD.h	Thu Jan 16 00:08:27 2014 +0600
+++ b/LOD.h	Thu Jan 16 17:34:48 2014 +0600
@@ -91,7 +91,7 @@
 
     FILE *pFile;
     char pLODName[256];
-    unsigned int isFileOpened;
+    bool isFileOpened;
     unsigned __int8 *pIOBuffer;
     unsigned int uIOBufferSize;
     struct FileHeader header;
--- a/Outdoor.cpp	Thu Jan 16 00:08:27 2014 +0600
+++ b/Outdoor.cpp	Thu Jan 16 17:34:48 2014 +0600
@@ -3855,7 +3855,7 @@
               v2 = 0;
               fall_speed = 0;
               *(float *)&v128 = 0.0;
-              if ( v102 && pZ < ceiling_height && (signed int)(pParty->uPartyHeight + pZ) >= ceiling_height )//столкновение с потолком(ошибка)
+              if ( v102 && pZ < ceiling_height && (signed int)(pParty->uPartyHeight + pZ) >= ceiling_height )//столкновение с потолком
               {
                 pParty->field_6E0 = 0;
                 pParty->field_6E4 = 0;
@@ -4133,6 +4133,7 @@
     if ( pParty->bFlying )
     {
       //v126 = stru_5C6E00->Cos(GetTickCount());
+      v129 = fixpoint_mul(4, cosf(GetTickCount()));
       v129 = (unsigned __int64)(4i64 * stru_5C6E00->Cos(GetTickCount())) >> 16;
       pZ = v113 + v129;
       if ( pModel )