changeset 2208:0b2eea6f80c9

for video in homes
author Ritor1
date Wed, 12 Feb 2014 16:33:12 +0600
parents ff8920a40c21
children 3664342f5d93
files Indoor.cpp LOD.cpp Outdoor.cpp VideoPlayer.h mm7_2.cpp
diffstat 5 files changed, 140 insertions(+), 146 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.cpp	Thu Feb 06 17:20:12 2014 +0600
+++ b/Indoor.cpp	Wed Feb 12 16:33:12 2014 +0600
@@ -3472,13 +3472,9 @@
           if ( v55 >= 50 )
             break;
           if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling )
-          {
             v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z;
-          }
           else
-          {
             v21 = fixpoint_mul(pFloor->zCalc1, x) + fixpoint_mul(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16);
-          }
           blv_floor_level[v55] = v21;
           blv_floor_id[v55] = pSector->pFloors[i];
           v55++;
@@ -3486,7 +3482,6 @@
     }
   }
 
-
   if ( pSector->field_0 & 8 )
   {
     for (uint i = 0; i < pSector->uNumPortals; ++i)
@@ -3551,6 +3546,8 @@
   if ( v55 == 1 )
   {
     *pFaceID = blv_floor_id[0];
+	if ( blv_floor_level[0] <= -29000 )
+		__debugbreak();
     return blv_floor_level[0];
   }
   if ( !v55 )
@@ -3585,12 +3582,16 @@
         if ( v38 > result && v38 <= z + 5 )
         {
           result = blv_floor_level[i];
+	if ( blv_floor_level[i] <= -29000 )
+		__debugbreak();
           *pFaceID = blv_floor_id[i];
         }
       }
       else if ( v38 < result )
       {
         result = blv_floor_level[i];
+	if ( blv_floor_level[i] <= -29000 )
+		__debugbreak();
         *pFaceID = blv_floor_id[i];
       }
   }
@@ -5981,7 +5982,7 @@
   int v80; // [sp+34h] [bp-2Ch]@1
   int v82; // [sp+3Ch] [bp-24h]@47
   int _view_angle; // [sp+40h] [bp-20h]@47
-  bool bJumping; // [sp+44h] [bp-1Ch]@1
+  bool hovering; // [sp+44h] [bp-1Ch]@1
   int new_party_y; // [sp+48h] [bp-18h]@1
   int new_party_x; // [sp+4Ch] [bp-14h]@1
   int party_z; // [sp+50h] [bp-10h]@1
@@ -5997,12 +5998,12 @@
   uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
   party_running_flag = false;
   party_walking_flag = false;
-  bJumping = false;
+  hovering = false;
 
   uFaceID = -1;
-  int floor_level = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
-
-  if ( pParty->bFlying )
+  int floor_level = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);//получить высоту пола
+
+  if ( pParty->bFlying )//отключить полёт
   {
     pParty->bFlying = false;
     if (pParty->FlyActive())
@@ -6043,8 +6044,8 @@
     }
   }
 
-  uint fall_start;
-  if (!pParty->FeatherFallActive())
+  int fall_start;
+  if (!pParty->FeatherFallActive())// не активно падение пера
   {
     bFeatherFall = false;
     if (!pParty->pPlayers[0].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) &&  // grants feather fall
@@ -6055,7 +6056,7 @@
       fall_start = pParty->uFallStartY;
     }
   }
-  else
+  else// активно падение пера
   {
     fall_start = floor_level;
     bFeatherFall = true;
@@ -6063,7 +6064,7 @@
   }
 
 
-  if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1)
+  if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1)//повреждение от падения с высоты
   {
     assert(~pParty->uFlags & PARTY_FLAGS_1_LANDING); // why land in indoor?
     if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
@@ -6080,40 +6081,39 @@
   }
 
   if ( party_z > floor_level + 1 )
-    bJumping = true;
-
-  bool jumping_up = false;
+    hovering = true;
+
+  bool not_high_fall = false;
 
   if ( party_z - floor_level <= 32 )
   {
     pParty->uFallStartY = party_z;
-    jumping_up = true;
+    not_high_fall = true;
   }
 
-  if (bWalkSound && pParty->walk_sound_timer)
+  if (bWalkSound && pParty->walk_sound_timer)//таймеры для звуков передвижения
   {
     if (pParty->walk_sound_timer > pEventTimer->uTimeElapsed)
       pParty->walk_sound_timer -= pEventTimer->uTimeElapsed;
     else pParty->walk_sound_timer = 0;
   }
 
-
-  if (party_z <= floor_level + 1)
+  if (party_z <= floor_level + 1)// группа ниже уровня пола
   {
     party_z = floor_level + 1;
     pParty->uFallStartY = floor_level + 1;
 
-    if (!bJumping && pParty->floor_face_pid != uFaceID)
+    if (!hovering && pParty->floor_face_pid != uFaceID)// не парящие и 
     {
       if (pIndoor->pFaces[uFaceID].uAttributes & FACE_PRESSURE_PLATE)
         uFaceEvent = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].uEventID;
     }
   }
-  if (!bJumping)
+  if (!hovering)
     pParty->floor_face_pid = uFaceID;
 
   bool on_water = false;
-  if ( pIndoor->pFaces[uFaceID].Fluid())
+  if ( pIndoor->pFaces[uFaceID].Fluid())// на воде
     on_water = true;
 
   //v81 = pParty->uWalkSpeed;
@@ -6172,7 +6172,7 @@
         v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier);
         party_walking_flag = true;
         break;
-      case PARTY_RunForward:
+      case PARTY_RunForward://Бег вперёд
         v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 2 * pParty->uWalkSpeed * fWalkSpeedMultiplier);
         v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 2 * pParty->uWalkSpeed * fWalkSpeedMultiplier);
         party_running_flag = true;
@@ -6204,9 +6204,9 @@
         _view_angle = 0;
         break;
       case PARTY_Jump:
-        if ( (!bJumping || party_z <= floor_level + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 )
+        if ( (!hovering || party_z <= floor_level + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 )
         {
-          bJumping = true;
+          hovering = true;
           pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
         }
         break;
@@ -6216,17 +6216,16 @@
   }
   pParty->sRotationY = angle;
   pParty->sRotationX = _view_angle;
-  if ( bJumping )
+  if ( hovering )//парящие
   {
-    pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
-    if ( bJumping && pParty->uFallSpeed <= 0 )
+    pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();// расчёт скорости падения
+    if ( hovering && pParty->uFallSpeed <= 0 )
     {
       if ( pParty->uFallSpeed < -500 && !pParty->bFlying )
       {
         for ( uint pl = 1; pl <= 4; pl++ )
         {
-          if ( !pPlayers[pl]->HasEnchantedItemEquipped(72)
-            && !pPlayers[pl]->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) //was 8 
+          if ( !pPlayers[pl]->HasEnchantedItemEquipped(72) && !pPlayers[pl]->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) //was 8 
              pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_SCARED, 0);
         }
       }
@@ -6234,9 +6233,9 @@
     else
       pParty->uFallStartY = party_z;
   }
-  else
+  else// не парящие
   {
-    if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 32768 )
+    if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 0x8000 )
     {
       pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength();
       pParty->uFallStartY = party_z;
@@ -6284,10 +6283,10 @@
     for ( uint j = 0; j < 100; ++j )
     {
       _46E44E_collide_against_faces_and_portals(1);
-      _46E0B2_collide_against_decorations();
+      _46E0B2_collide_against_decorations();//столкновения с декором
       for ( v80 = 0; v80 < (signed int)uNumActors; ++v80 )
-        Actor::_46DF1A_collide_against_actor(v80, 0);
-      if ( _46F04E_collide_against_portals() )
+        Actor::_46DF1A_collide_against_actor(v80, 0);//столкновения с монстрами
+      if ( _46F04E_collide_against_portals() )//столкновения с порталами
         break;
     }
     if ( stru_721530.field_7C >= stru_721530.field_6C )
@@ -6305,7 +6304,7 @@
     v42 = collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID);
     if ( v42 == -30000 || v42 - new_party_z > 128 )
       return;
-    if ( stru_721530.field_7C >= stru_721530.field_6C )
+    if ( stru_721530.field_7C >= stru_721530.field_6C )//???
     {
       new_party_x = stru_721530.normal2.x;
       new_party_y = stru_721530.normal2.y;
@@ -6317,24 +6316,23 @@
     uSectorID = stru_721530.uSectorID;
     stru_721530.field_70 += stru_721530.field_7C;
     unsigned long long v87 = new_party_z + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
-    if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)
+    if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)//при столкновении с монстром
     {
-      if ( SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) >= 0
-        && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime)) )
+      if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0 )
         pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
       viewparams->bRedrawGameUI = true;
     }
-    else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
+    else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)//при столкновении с декорацией
     {
       v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x,
               new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y);
       v2 = fixpoint_mul(stru_5C6E00->Cos(v54), integer_sqrt(v2 * v2 + v1 * v1));
       v1 = fixpoint_mul(stru_5C6E00->Sin(v54), integer_sqrt(v2 * v2 + v1 * v1));
     }
-    else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
+    else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)//при столкновении с bmodel
     {
       pFace = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3];
-      if ( pFace->uPolygonType == POLYGON_Floor )
+      if ( pFace->uPolygonType == POLYGON_Floor )// если bmodel - пол
       {
         if ( pParty->uFallSpeed < 0 )
           pParty->uFallSpeed = 0;
@@ -6349,10 +6347,10 @@
         if ( pParty->floor_face_pid != PID_ID(stru_721530.uFaceID) && pFace->Pressure_Plate() )
           uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
       }
-      else
+      else// если не пол
       {
         v46 = pParty->uFallSpeed * pFace->pFacePlane_old.vNormal.z;
-        if ( pFace->uPolygonType != POLYGON_InBetweenFloorAndWall )
+        if ( pFace->uPolygonType != POLYGON_InBetweenFloorAndWall )//полез на холм
         {
           v80 = abs(v1 * pFace->pFacePlane_old.vNormal.y + v46 + v2 * pFace->pFacePlane_old.vNormal.x) >> 16;
           if ((stru_721530.speed >> 3) > v80 )
@@ -6402,13 +6400,13 @@
   }
 
   //  //Воспроизведение звуков ходьбы/бега-------------------------
-  uint pX_ = pParty->vPosition.x - new_party_x;
-  uint pY_ = pParty->vPosition.y - new_party_y;
-  uint pZ_ = pParty->vPosition.z - new_party_z;
+  uint pX_ = abs(pParty->vPosition.x - new_party_x);
+  uint pY_ = abs(pParty->vPosition.y - new_party_y);
+  uint pZ_ = abs(pParty->vPosition.z - new_party_z);
   if ( bWalkSound && pParty->walk_sound_timer <= 0 )
   {
     pAudioPlayer->_4AA258(804);//stop sound
-    if ( party_running_flag && (!bJumping || jumping_up) ) //для бега
+    if ( party_running_flag && (!hovering || not_high_fall) ) //Бег и (не прыжок или не высокое падение )
     {
       if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 16 )
       {
@@ -6418,10 +6416,10 @@
           pAudioPlayer->PlaySound((SoundID)50, 804, 1, -1, 0, 0, 0, 0);
         else
           pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0);
-        pParty->walk_sound_timer = 64;
+        pParty->walk_sound_timer = 96;//64
       }
     }
-    else if ( party_walking_flag && (!bJumping || jumping_up) )//для ходьбы
+    else if ( party_walking_flag && (!hovering || not_high_fall) )//Ходьба и (не прыжок или не высокое падение)
     {
       if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 8 )
       {
@@ -6431,14 +6429,14 @@
           pAudioPlayer->PlaySound((SoundID)89, 804, 1, -1, 0, 0, 0, 0);
         else
           pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);
-        pParty->walk_sound_timer = 64;
+        pParty->walk_sound_timer = 144;//64
       }
     }
   }
   if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) < 8 )//отключить  звук ходьбы при остановке
     pAudioPlayer->_4AA258(804);
   //-------------------------------------------------------------
-  if ( !bJumping || jumping_up )
+  if ( !hovering || !not_high_fall )
     pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
   else
     pParty->uFlags |= PARTY_FLAGS_1_FALLING;
@@ -6447,7 +6445,7 @@
   pParty->vPosition.z = new_party_z;
   pParty->vPosition.y = new_party_y;
   //pParty->uFallSpeed = v89;
-  if ( !bJumping && pIndoor->pFaces[uFaceID].uAttributes & FACE_UNKNOW5 )
+  if ( !hovering && pIndoor->pFaces[uFaceID].uAttributes & FACE_UNKNOW5 )
     pParty->uFlags |= 0x200;
   if (uFaceEvent)
     EventProcessor(uFaceEvent, 0, 1);
--- a/LOD.cpp	Thu Feb 06 17:20:12 2014 +0600
+++ b/LOD.cpp	Wed Feb 12 16:33:12 2014 +0600
@@ -1383,72 +1383,70 @@
 //----- (00461FD4) ---LODFile_sub_461FD4---text:004632EA  --------------------------------------------------
 int LODWriteableFile::FixDirectoryOffsets()
 {
-    int total_size; // edi@1
-    int temp_offset; // ecx@5
-    FILE *tmp_file; // eax@9
-    size_t write_size; // edi@12
-    int result;
-    char Filename[256]; // [sp+Ch] [bp-228h]@9
-    char NewFilename[256]; // [sp+10Ch] [bp-128h]@15
-    int i;
+  int total_size; // edi@1
+  int temp_offset; // ecx@5
+  FILE *tmp_file; // eax@9
+  size_t write_size; // edi@12
+  int result;
+  char Filename[256]; // [sp+Ch] [bp-228h]@9
+  char NewFilename[256]; // [sp+10Ch] [bp-128h]@15
+  int i;
 
-    total_size = 0;
-    for (i=0;i<uNumSubDirs;i++)
-         total_size+=pSubIndices[i].uDataSize;
-    //fix offsets
-     temp_offset = sizeof(LOD::Directory) * uNumSubDirs;
-     for (i=0;i<uNumSubDirs;i++)
-            {
-            pSubIndices[i].uOfsetFromSubindicesStart=temp_offset;
-            temp_offset+=pSubIndices[i].uDataSize;
-         }
-    strcpy(Filename, "lod.tmp");
-    tmp_file = fopen(Filename, "wb+");
+  total_size = 0;
+  for ( i = 0; i < uNumSubDirs; i++ )
+    total_size += pSubIndices[i].uDataSize;
+  //fix offsets
+  temp_offset = sizeof(LOD::Directory) * uNumSubDirs;
+  for ( i = 0; i < uNumSubDirs; i++ )
+  {
+    pSubIndices[i].uOfsetFromSubindicesStart=temp_offset;
+    temp_offset+=pSubIndices[i].uDataSize;
+  }
+  strcpy(Filename, "lod.tmp");
+  tmp_file = fopen(Filename, "wb+");
 
-    if ( tmp_file )
-    {
-        fwrite((const void *)&header, sizeof(LOD::FileHeader), 1, tmp_file);
+  if ( tmp_file )
+  {
+    fwrite((const void *)&header, sizeof(LOD::FileHeader), 1, tmp_file);
 
-        LOD::Directory Lindx;
-        strcpy(Lindx.pFilename, "chapter");
-        Lindx.uOfsetFromSubindicesStart=uOffsetToSubIndex; //10h 16
-        Lindx.uDataSize=sizeof(LOD::Directory) * uNumSubDirs + total_size;		   //14h 20
-        Lindx.dword_000018=0;		   //18h 24 
-        Lindx.uNumSubIndices=uNumSubDirs;		   //1ch 28
-        Lindx.word_00001E=0;		   // 1Eh 30
-        fwrite(&Lindx, sizeof(LOD::Directory), 1, tmp_file);
-        fwrite(pSubIndices, sizeof(LOD::Directory), uNumSubDirs, tmp_file);
-        fseek(pOutputFileHandle, 0, 0);
-        if ( total_size > 0 )
-            {
-            do
-                {
-                write_size = uIOBufferSize;
-                if ( total_size <= (signed int)uIOBufferSize )
-                    write_size =total_size;
-                fread(pIOBuffer, 1,  write_size,  pOutputFileHandle);
-                fwrite(pIOBuffer, 1,  write_size, tmp_file);
-                total_size -=  write_size;
-                }
-                while ( total_size > 0 );
-            }
-        strcpy(NewFilename, (const char *)&pLODName);
-        fclose(tmp_file);
-        fclose(pOutputFileHandle);
-        CloseWriteFile();
-        remove("lodapp.tmp");
-        remove(NewFilename);
-        rename(Filename, NewFilename);
-        CloseWriteFile();
-        LoadFile( (const char *)&pLODName, 0);
-        result = 0;
-        }
-    else
-        {
-        result = 5;
-        }
-    return result;
+    LOD::Directory Lindx;
+    strcpy(Lindx.pFilename, "chapter");
+    Lindx.uOfsetFromSubindicesStart = uOffsetToSubIndex; //10h 16
+    Lindx.uDataSize = sizeof(LOD::Directory) * uNumSubDirs + total_size;		   //14h 20
+    Lindx.dword_000018 = 0;		   //18h 24 
+    Lindx.uNumSubIndices = uNumSubDirs;		   //1ch 28
+    Lindx.word_00001E = 0;		   // 1Eh 30
+    fwrite(&Lindx, sizeof(LOD::Directory), 1, tmp_file);
+    fwrite(pSubIndices, sizeof(LOD::Directory), uNumSubDirs, tmp_file);
+    fseek(pOutputFileHandle, 0, 0);
+    if ( total_size > 0 )
+    {
+      do
+      {
+        write_size = uIOBufferSize;
+        if ( total_size <= (signed int)uIOBufferSize )
+          write_size =total_size;
+        fread(pIOBuffer, 1,  write_size,  pOutputFileHandle);
+        fwrite(pIOBuffer, 1,  write_size, tmp_file);
+        total_size -=  write_size;
+      }
+      while ( total_size > 0 );
     }
+    strcpy(NewFilename, (const char *)&pLODName);
+    fclose(tmp_file);
+    fclose(pOutputFileHandle);
+    CloseWriteFile();
+    remove("lodapp.tmp");
+    remove(NewFilename);
+    rename(Filename, NewFilename);
+    CloseWriteFile();
+    LoadFile( (const char *)&pLODName, 0);
+    result = 0;
+  }
+  else
+    result = 5;
+  return result;
+}
 
 //----- (00461F71) --------------------------------------------------------
 bool LOD::File::AppendDirectory(LOD::Directory *pDir, const void *pData)
@@ -1491,6 +1489,8 @@
     fclose(pFile);
     pFile = 0;
   }
+  //else 
+    //__debugbreak();
 }
 // 6A0CA8: using guessed type int 6A0CA8_lod_unused;
 
@@ -1641,25 +1641,18 @@
     to_copy_size -= read_size;
   }
   //replace	  old file by new with added  data
-  strcpy(NewFilename, pLODName);
+  strcpy(NewFilename, (const char *)&pLODName);
   fclose(tmp_file);
-  bool test_file_opened1 = isFileOpened;
-  CloseWriteFile(); //isFileOpened == false, current file
-  bool test_file_opened2 = isFileOpened;
+  fclose(pFile);
+  CloseWriteFile();
   remove(NewFilename);
-  bool test_file_opened3 = isFileOpened;
   rename(Filename, NewFilename);
-  bool test_file_opened4 = isFileOpened;
   CloseWriteFile();
-  bool test_file_opened5 = isFileOpened;
   //reload new
-  LoadFile(pLODName, 0);//isFileOpened == true, next file
-  if (isFileOpened == false)
-		__debugbreak();
+  LoadFile((const char *)&pLODName, 0);//isFileOpened == true, next file
   return 0;
 }
 
-
 //----- (00461A43) --------------------------------------------------------
 bool LODWriteableFile::LoadFile(const char *pFilename, bool bWriting)
 {
--- a/Outdoor.cpp	Thu Feb 06 17:20:12 2014 +0600
+++ b/Outdoor.cpp	Wed Feb 12 16:33:12 2014 +0600
@@ -3406,7 +3406,7 @@
   int v96; // [sp-4h] [bp-98h]@246
   int v97; // [sp+Ch] [bp-88h]@180
   Vec3_int_ v98;
-  bool high_fall_flag; // [sp+1Ch] [bp-78h]@33
+  bool not_high_fall; // [sp+1Ch] [bp-78h]@33
   int v102; // [sp+20h] [bp-74h]@1
   int trigger_id; // [sp+24h] [bp-70h]@1
   bool bFeatherFall; // [sp+28h] [bp-6Ch]@4
@@ -3488,9 +3488,7 @@
   if ( floor_level - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 )//падение на 3D Model
   {
     if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
-    {
       pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
-    }
     else for (int i = 0; i < 4; ++i)     // receive falling damage
     {
       if ( !pParty->pPlayers[i].HasEnchantedItemEquipped(72) && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) )
@@ -3515,7 +3513,7 @@
   }
   else
     hovering = true;
-  high_fall_flag = pZ - v111 <= 32;
+  not_high_fall = pZ - v111 <= 32;
 
   if ( bWalkSound && pParty->walk_sound_timer)//timer update
   {
@@ -4155,15 +4153,15 @@
   }
 
   //Воспроизведение звуков ходьбы/бега------------------------
-  v122 = abs(pParty->vPosition.x - pX);
+  uint pX_ = abs(pParty->vPosition.x - pX);
   uint pY_ = abs(pParty->vPosition.y - pY);
-  v62 = abs(pParty->vPosition.z - pZ);
+  uint pZ_ = abs(pParty->vPosition.z - pZ);
   if ( bWalkSound && pParty->walk_sound_timer <= 0 )
   {
     pAudioPlayer->_4AA258(804);//stop sound
-    if ( party_running_flag && (!hovering || high_fall_flag) )
+    if ( party_running_flag && (!hovering || not_high_fall) )
     {
-      if ( integer_sqrt(v122 * v122 + pY_ * pY_ + v62 * v62) >= 16 )
+      if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 16 )
       {
         if ( !is_not_on_bmodel && pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible() )
           pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0);//бег на 3D Modelи
@@ -4175,9 +4173,9 @@
         pParty->walk_sound_timer = 96;//таймер для бега
       }
     }
-    else if( party_walking_flag && (!hovering || high_fall_flag) )
+    else if( party_walking_flag && (!hovering || not_high_fall) )
     {
-      if ( integer_sqrt(v122 * v122 + pY_ * pY_ + v62 * v62) >= 8 )
+      if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 8 )
       {
         if ( !is_not_on_bmodel && pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible() )
           pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);// хождение на 3D Modelи
@@ -4190,10 +4188,10 @@
       }
     }
   }
-  if ( integer_sqrt(v122 * v122 + pY_ * pY_ + v62 * v62) < 8 )//отключить  звук ходьбы при остановке
+  if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) < 8 )//отключить  звук ходьбы при остановке
     pAudioPlayer->_4AA258(804);
 //------------------------------------------------------------------------
-  if ( !hovering || !high_fall_flag )
+  if ( !hovering || !not_high_fall )//  или не высокое падение
     pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
   else
     pParty->uFlags |= PARTY_FLAGS_1_FALLING;
@@ -4268,12 +4266,12 @@
   }
 //-----------------------------------------------------------------
   //v76 = pParty->bFlying;
-  if ( pParty->bFlying || !high_fall_flag || bWaterWalk || !v122_a )
+  if ( pParty->bFlying || !not_high_fall || bWaterWalk || !v122_a )// полёт или высокое падение или хождение по воде или 
     v77 = 1;
   else
     v77 = v122 != 0;
   bool party_drowning_flag = false;
-  if ( !pParty->bFlying && high_fall_flag && !bWaterWalk ) //не полёт, высокое падение, не хождение по воде
+  if ( !pParty->bFlying && not_high_fall && !bWaterWalk ) //не полёт и не высокое падение и не хождение по воде
   {
     if ( v122_a )
       v78 = v69 != 0;
--- a/VideoPlayer.h	Thu Feb 06 17:20:12 2014 +0600
+++ b/VideoPlayer.h	Wed Feb 12 16:33:12 2014 +0600
@@ -266,13 +266,20 @@
 
 		int num_processed_buffers;
 		alGetSourcei(samples_source_id, AL_BUFFERS_PROCESSED, &num_processed_buffers);
-		while (num_processed_buffers)
+		/*while (num_processed_buffers)
 		{
 			unsigned int processed_buffers_id[4];
 			alSourceUnqueueBuffers(samples_source_id, min(4, num_processed_buffers), processed_buffers_id);
 			CheckError();
 			alGetSourcei(samples_source_id, AL_BUFFERS_PROCESSED, &num_processed_buffers);
-		}
+		}*/
+      for (int i = 0; i < num_processed_buffers; ++i)
+      {
+        unsigned int processed_buffer_id;
+        alSourceUnqueueBuffers(samples_source_id, 1, &processed_buffer_id);
+        if (!CheckError())
+          alDeleteBuffers(1, &processed_buffer_id);
+      }
 
 		int num_queued_buffers;
 		alGetSourcei(samples_source_id, AL_BUFFERS_QUEUED, &num_queued_buffers);
--- a/mm7_2.cpp	Thu Feb 06 17:20:12 2014 +0600
+++ b/mm7_2.cpp	Wed Feb 12 16:33:12 2014 +0600
@@ -2225,8 +2225,6 @@
     return result;
 }
 
-
-
 //----- (00452B2E) --------------------------------------------------------
 int __fastcall GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides)
 {