changeset 2425:d922225a6081

Hot key for mm7 main menu
author Ritor1
date Wed, 23 Jul 2014 16:06:17 +0600
parents 1b6bf88f561b
children 22ac062b40f7
files Build/Visual Studio 2010/World of Might and Magic.vcxproj.user Keyboard.cpp MMT.cpp OSWindow.cpp PaletteManager.cpp Render.cpp Timer.cpp TurnEngine.cpp VideoPlayer.cpp mm7_2.cpp mm7_data.cpp mm7_data.h stru6.cpp stru6.h
diffstat 14 files changed, 153 insertions(+), 186 deletions(-) [+]
line wrap: on
line diff
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj.user	Tue Jul 22 23:07:24 2014 +0200
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.user	Wed Jul 23 16:06:17 2014 +0600
@@ -3,7 +3,7 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <LocalDebuggerWorkingDirectory>..\..\..\MM_VII</LocalDebuggerWorkingDirectory>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
-    <LocalDebuggerCommandArguments>-nomarg</LocalDebuggerCommandArguments>
+    <LocalDebuggerCommandArguments>-nomarg, -novideo</LocalDebuggerCommandArguments>
     <LocalDebuggerCommand>$(OutDir)$(TargetName)$(TargetExt)</LocalDebuggerCommand>
   </PropertyGroup>
 </Project>
\ No newline at end of file
--- a/Keyboard.cpp	Tue Jul 22 23:07:24 2014 +0200
+++ b/Keyboard.cpp	Wed Jul 23 16:06:17 2014 +0600
@@ -150,8 +150,10 @@
 //----- (00459E3F) --------------------------------------------------------
 void KeyboardActionMapping::ResetKeys()
 {
+  //Функция GetAsyncKeyState определяет, является ли клавиша отпущенной или нажатой во время вызова функции
+  //и была ли клавиша нажата после предыдущего вызова GetAsyncKeyState.
   for (uint i = 0; i < 30; ++i)
-    GetAsyncKeyState(pVirtualKeyCodesMapping[i]);
+    pToggleTypes[i] = (KeyToggleType)GetAsyncKeyState(pVirtualKeyCodesMapping[i]);
 }
 
 //----- (00459E5A) --------------------------------------------------------
--- a/MMT.cpp	Tue Jul 22 23:07:24 2014 +0200
+++ b/MMT.cpp	Wed Jul 23 16:06:17 2014 +0600
@@ -182,8 +182,8 @@
   pGUIWindow2 = 0;
   pAudioPlayer->StopChannels(-1, -1);//остановить/подготовить канал
 
-  if (!bNoSound )
-    PlayAudio(L"Sounds\\New_Sounds/Stronghold_Theme.mp3");//воспроизводим мп3
+  //if (!bNoSound )
+    //PlayAudio(L"Sounds\\New_Sounds/Stronghold_Theme.mp3");//воспроизводим мп3
   //if (!bNoVideo )
     //pVideoPlayer->PlayMovie(L"Anims\\New_Video/3DOLOGO.smk");
 
--- a/OSWindow.cpp	Tue Jul 22 23:07:24 2014 +0200
+++ b/OSWindow.cpp	Wed Jul 23 16:06:17 2014 +0600
@@ -466,11 +466,15 @@
   {
     CREATESTRUCTA* cs = (CREATESTRUCTA *)(lparam);
     OSWindow* window = (OSWindow *)cs->lpCreateParams;
-
+	//Функция SetWindowLongPtr изменяет атрибуты указанного окна. Функция также устанавливает и значение
+	// при заданном смещении в дополнительной памяти окна.
     SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR)window);
     return DefWindowProcW(hwnd, msg, wparam, lparam);
   }
-
+  //Функция GetWindowLongPtr извлекает информацию об определяемом окне. Функция также извлекает данные и о значение
+  //при заданном смещении в дополнительной памяти окна.
+  //GWLP_USERDATA - Извлекает пользовательские данные, связанные с окном. Эти данные предназначаются для использования приложением, 
+  //которое создавало окно. Его значение первоначально является нулевым.
   OSWindow* window = (OSWindow *)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
   if (window && window->api_handle == hwnd)	//Uninitialized memory access
   {
@@ -478,6 +482,8 @@
     if (window->WinApiMessageProc(msg, wparam, lparam, &result))
       return result;
   }
+  //Функция DefWindowProc вызывается оконной процедурой по умолчанию, чтобы обеспечить обработку по умолчанию любого 
+  //сообщения окна, которые приложение не обрабатывает. Эта функция гарантирует то, что обрабатывается каждое сообщение. 
   return DefWindowProcW(hwnd, msg, (WPARAM)wparam, (LPARAM)lparam);
 }
 
--- a/PaletteManager.cpp	Tue Jul 22 23:07:24 2014 +0200
+++ b/PaletteManager.cpp	Wed Jul 23 16:06:17 2014 +0600
@@ -355,7 +355,7 @@
 
   v2 = this;
   //v3 = (char *)pBaseColors[a2];
-  if (pPalette_tintColor[0] || pPalette_tintColor[1] || pPalette_tintColor[2]) //Uninitialized memory access
+  if (pPalette_tintColor[0] || pPalette_tintColor[1] || pPalette_tintColor[2])
   {
     //v8 = 0;
     //i = 0;
@@ -566,7 +566,7 @@
 
   //v45 = pPalette_mistColor[0];
   float mist_a, mist_b, mist_c;
-  if (pPalette_mistColor[0] || pPalette_mistColor[1] || pPalette_mistColor[2]) //Uninitialized memory access
+  if (pPalette_mistColor[0] || pPalette_mistColor[1] || pPalette_mistColor[2])
   {
     //v46 = (double)v45;
     //v80 = pPalette_mistColor[1];
--- a/Render.cpp	Tue Jul 22 23:07:24 2014 +0200
+++ b/Render.cpp	Wed Jul 23 16:06:17 2014 +0600
@@ -272,7 +272,7 @@
     }
   }
 //-------(Отсечение невидимой части карты)------------------------------------------------------------------------------------------
-  float direction = pGame->pIndoorCameraD3D->sRotationY / 256;//direction of the camera(напрвление камеры)
+  float direction = (float)(pGame->pIndoorCameraD3D->sRotationY / 256);//direction of the camera(напрвление камеры)
   //0-East(B)
   //1-NorthEast(CB)
   //2-North(C)
@@ -281,7 +281,7 @@
   //5-SouthWest(ЮЗ)
   //6-South(Ю)
   //7-SouthEast(ЮВ)
-  int Start_X, End_X, Start_Z, End_Z;
+  unsigned int Start_X, End_X, Start_Z, End_Z;
   if ( direction >= 0 && direction < 1.0 )//East(B) - NorthEast(CB)
   {
     Start_X = pODMRenderParams->uMapGridCellX - 2, End_X = 127;
@@ -507,7 +507,7 @@
   billboard.uViewportW = pViewport->uViewportBR_Y;
   pODMRenderParams->uNumBillboards = uNumBillboardsToDraw;
 
-  for (int i = 0; i < ::uNumBillboardsToDraw; ++i)
+  for (unsigned int i = 0; i < ::uNumBillboardsToDraw; ++i)
   {
     billboard.uScreenSpaceX = pBillboardRenderList[i].uScreenSpaceX;
     billboard.uScreenSpaceY = pBillboardRenderList[i].uScreenSpaceY;
@@ -574,7 +574,7 @@
   signed __int16 v46; // [sp+3Ch] [bp-4h]@12
 
   //v41 = 0;
-  for (int i = 0; i < uNumSpriteObjects; ++i)
+  for (unsigned int i = 0; i < uNumSpriteObjects; ++i)
   {
     SpriteObject* object = &pSpriteObjects[i];
     //auto v0 = (char *)&pSpriteObjects[i].uSectorID;
@@ -949,7 +949,7 @@
   int v42; // [sp+98h] [bp-Ch]@9
   int b; // [sp+A0h] [bp-4h]@22
 
-  for (int i = 0; i < uNumLevelDecorations; ++i)
+  for (unsigned int i = 0; i < uNumLevelDecorations; ++i)
   {
     //LevelDecoration* decor = &pLevelDecorations[i];
     if ((!(pLevelDecorations[i].uFlags & LEVEL_DECORATION_OBELISK_CHEST)
@@ -2191,9 +2191,6 @@
 //----- (0049EB79) --------------------------------------------------------
 Render::~Render()
 {
-  Render *v1; // esi@1
-
-  //v1 = this;
   free(this->pDefaultZBuffer);
   this->pD3DBitmaps.Release();
   this->pD3DSprites.Release();
@@ -2341,7 +2338,7 @@
   PCXHeader_2 header2; // [sp+140h] [bp-24h]@10
   char *lineRGB; // [sp+148h] [bp-1Ch]@10
   void *surface; // [sp+14Ch] [bp-18h]@8
-  int image_width; // [sp+150h] [bp-14h]@4
+  unsigned int image_width; // [sp+150h] [bp-14h]@4
   int pitch; // [sp+154h] [bp-10h]@4
   char v31; // [sp+15Ah] [bp-Ah]@25
   unsigned char pict_byte; // [sp+15Bh] [bp-9h]@17
@@ -2419,7 +2416,7 @@
         image_width = 3 * pitch;
         //v24 = 2 * v5;
         v8 = (unsigned short *)surface;
-        for ( int y = 0; y < this->GetRenderHeight(); y++ )
+        for ( unsigned int y = 0; y < this->GetRenderHeight(); y++ )
         {
           line_picture_data = v8;
           if ( GetRenderWidth() > 0 )
@@ -4974,7 +4971,7 @@
       v5 = 31 - (pSkyPolygon->dimming_level & 0x1F);
       if ( v5 < pOutdoor->max_terrain_dimming_level )
         v5 = pOutdoor->max_terrain_dimming_level;
-      for (uint i = 0; i < uNumVertices; ++i)
+      for (uint i = 0; i < (unsigned int)uNumVertices; ++i)
       {
         d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX;
         d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY;
@@ -5000,7 +4997,6 @@
   signed __int64 v6; // qax@3
   int v12; // edx@7
   int v13; // eax@7
-//  void *v15; // ecx@9
   int v17; // edi@9
   double v18; // st7@9
   signed int v19; // ebx@9
@@ -5008,16 +5004,8 @@
   int v21; // ebx@11
   int v22; // eax@14
   signed __int64 v23; // qtt@16
-//  double v24; // st7@16
-//  unsigned __int8 v25; // sf@16
-//  unsigned __int8 v26; // of@16
   double v28; // st7@20
-//  char *v29; // ebx@20
-//  char *v30; // edx@20
-//  unsigned __int8 v31; // c0@21
-//  unsigned __int8 v32; // c3@21
   double v33; // st6@23
-//  char *v34; // esi@30
   const void *v35; // ecx@31
   int v36; // eax@31
   const void *v37; // edi@31
@@ -5027,24 +5015,12 @@
   int v41; // eax@36
   signed __int64 v42; // qtt@39
   int v43; // eax@39
-//  char v44; // zf@39
-//  double v45; // st7@39
-//  double v46; // st7@39
-//  unsigned int v47; // edx@40
   double v48; // st7@41
-//  RenderVertexSoft *v49; // ebx@41
-//  void *v50; // edi@43
   double v51; // st7@46
-//  RenderVertexSoft *v52; // edx@46
-//  void *v53; // edi@48
-//  signed int v59; // [sp-4h] [bp-178h]@17
-//  struct Polygon *v60; // [sp+0h] [bp-174h]@17
-//  IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17
   struct Polygon pSkyPolygon; // [sp+14h] [bp-160h]@6
   unsigned int v63; // [sp+120h] [bp-54h]@7
   unsigned int v65; // [sp+128h] [bp-4Ch]@1
   unsigned int v66; // [sp+12Ch] [bp-48h]@7
-  //float v67; // [sp+130h] [bp-44h]@7
   __int64 v69; // [sp+13Ch] [bp-38h]@3
   int v70; // [sp+144h] [bp-30h]@3
   int X; // [sp+148h] [bp-2Ch]@9
@@ -6229,7 +6205,6 @@
 void Render::_4A4CC9_AddSomeBillboard(stru6_stru1_indoor_sw_billboard *a1, int diffuse)
 {
   unsigned int v5; // eax@7
-//  char *v7; // edx@8
   double v10; // st6@9
   double v11; // st6@10
   int v12; // ebx@13
@@ -6238,7 +6213,7 @@
     return;
 
   float depth = 1000000.0;
-  for (uint i = 0; i < a1->uNumVertices; ++i)
+  for (uint i = 0; i < (unsigned int)a1->uNumVertices; ++i)
   {
     if (a1->field_104[i].z < depth)
       depth = a1->field_104[i * 4].z;
@@ -6252,7 +6227,7 @@
   pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices;
   pBillboardRenderListD3D[v5].z_order = depth;
 
-  for (uint i = 0; i < a1->uNumVertices; ++i)
+  for (uint i = 0; i < (unsigned int)a1->uNumVertices; ++i)
   {
     pBillboardRenderListD3D[v5].pQuads[i].pos.x = a1->field_104[i].x;
     pBillboardRenderListD3D[v5].pQuads[i].pos.y = a1->field_104[i].y;
@@ -6336,7 +6311,7 @@
         bMipMaps = 0;
         v13 = pHWLTexture->pPixels;
         v14 = (unsigned __int16 *)desc.lpSurface;
-        for(int bMipMaps = 0; bMipMaps < desc.dwHeight; bMipMaps++)
+        for(uint bMipMaps = 0; bMipMaps < desc.dwHeight; bMipMaps++)
         {
           for (v15 = 0; v15 < desc.dwWidth; v15++)
           {
@@ -6381,9 +6356,9 @@
     {
       v9 = sprite_texture->pPixels;
       v10 = Dst.lpSurface;
-      for (int i=0; i<sprite_texture->uHeight; ++i)
-      {
-        for (int j=0; j<sprite_texture->uWidth/2; ++j)
+      for (uint i=0; i<sprite_texture->uHeight; ++i)
+      {
+        for (uint j=0; j<sprite_texture->uWidth/2; ++j)
         {
           *(int *)v10 = *(int *)v9;
           v9 += 2;
@@ -6934,7 +6909,7 @@
       }
     }
 
-    for (int y = 0; y < v6; ++y)
+    for (uint y = 0; y < v6; ++y)
     {
       for (int x = 0; x < v5; ++x)
       {
@@ -7121,9 +7096,9 @@
       }
     }
 
-    for (int y = 0; y < v10; ++y)
-    {
-      for (int x = 0; x < v9; ++x)
+    for (uint y = 0; y < v10; ++y)
+    {
+      for (uint x = 0; x < v9; ++x)
       {
         if (*v24)
         {
@@ -7238,7 +7213,7 @@
     if ( a8 )
     {
       v28 = 0x7FF; // 16bit pRenderer->uTargetGMask | pRenderer->uTargetBMask;
-      for (int dy = 0; dy < v9; ++dy)
+      for (uint dy = 0; dy < v9; ++dy)
       {
         for (int dx = 0; dx < v8; ++dx)
         {
@@ -7286,7 +7261,7 @@
     }
     else
     {
-      for (int dy = 0; dy < v9; ++dy)
+      for (uint dy = 0; dy < v9; ++dy)
       {
         for (int dx = 0; dx < v8; ++dx)
         {
@@ -7513,7 +7488,7 @@
         }
         
           v16 = v19;
-        for (int y = 0; y < v5; ++y)
+        for (uint y = 0; y < v5; ++y)
         {
           for (int x = 0; x < v20; ++x)
           {
@@ -7612,7 +7587,7 @@
       }
     }
 
-    for (int dy = 0; dy < uHeight; ++dy)
+    for (uint dy = 0; dy < uHeight; ++dy)
     {
       for (int dx = 0; dx < Width; ++dx)
       {
@@ -8259,7 +8234,7 @@
       pPaletteManager->RecalculateAll();
       pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
       pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
-      for (int i = 0; i < pObjectList->uNumObjects; i++)
+      for (uint i = 0; i < pObjectList->uNumObjects; i++)
       {
         BYTE3(v4) = 0;
         v5 = &pObjectList->pObjects[i];
@@ -8446,7 +8421,7 @@
     v5 = this->pFile;
     this->uDataOffset = v4;
     fwrite(&this->uNumItems, 4u, 1u, v5);
-    for (int i = 0; i < this->uNumItems; i++)
+    for (uint i = 0; i < this->uNumItems; i++)
     {
       fwrite(this->pSpriteNames[i], 1u, 0x14u, this->pFile);
       fprintf(File, "D3D texture name:  %s\t\toffset: %x\n", this->pSpriteNames[i], *(unsigned int *)(&(this->pSpriteNames[i]) + 200000/sizeof(char*)));
@@ -8460,7 +8435,7 @@
   else
   {
     fclose(this->pFile);
-    for (int i = 0; i < this->uNumItems; i++)
+    for (uint i = 0; i < this->uNumItems; i++)
     {
       free(this->pSpriteNames[i]);
     }
@@ -8664,7 +8639,7 @@
   //  v2                     v1
 
   int out_num_vertices = 0;
-  for (int i = 0; i < num_vertices; ++i)
+  for (uint i = 0; i < num_vertices; ++i)
   {
     next_vertices_flag = array_50AC10[i + 1].vWorldViewPosition.x <= 8.0;//
     if ( current_vertices_flag ^ next_vertices_flag )
@@ -8812,7 +8787,7 @@
   unused = 0;
   if ( (signed int)pOutdoor->uNumBModels > 0 )
   {
-    for ( uint model_id = 0; model_id < pOutdoor->uNumBModels; model_id++ )
+    for ( uint model_id = 0; model_id < (unsigned int)pOutdoor->uNumBModels; model_id++ )
     {
       if ( IsBModelVisible(model_id, &unused) )
       {
@@ -9190,9 +9165,9 @@
 
   if ( LockSurface_DDraw4(pBackBuffer4, &Dst, DDLOCK_WAIT) )
   {
-    for (uint y = 0; y < height; ++y)
-    {
-      for (uint x = 0; x < width; ++x)
+    for (uint y = 0; y < (unsigned int)height; ++y)
+    {
+      for (uint x = 0; x < (unsigned int)width; ++x)
       {
         //*v3 = pRenderer->ReadPixel16((int)(x* interval_x + 8.0), (int)(y * interval_y + 8.0));//screen_data[screen_y + (int)(x* interval_x + 8.0)];
 		  /*
@@ -9547,7 +9522,7 @@
   else
     color_mult = pDecal->field_C18->_43B570_get_color_mult_by_time();
 
-  for (uint i = 0; i < pDecal->uNumVertices; ++i)
+  for (uint i = 0; i < (unsigned int)pDecal->uNumVertices; ++i)
   {
     uint uTint = Render::GetActorTintColor(pDecal->pVertices[i].vWorldViewPosition.x, pDecal->field_C14, 0, 0, nullptr);
 
--- a/Timer.cpp	Tue Jul 22 23:07:24 2014 +0200
+++ b/Timer.cpp	Wed Jul 23 16:06:17 2014 +0600
@@ -49,7 +49,8 @@
 {
   if (bPaused)
   {
-    pKeyActionMap->ResetKeys();
+    pKeyActionMap->ResetKeys();//Unhandled application exception
+
     bPaused = 0;
     uStartTime = Time();
   }
--- a/TurnEngine.cpp	Tue Jul 22 23:07:24 2014 +0200
+++ b/TurnEngine.cpp	Wed Jul 23 16:06:17 2014 +0600
@@ -236,7 +236,7 @@
       pActors[PID_ID(pQueue[i].uPackedID)].uAttributes &= ~0x80;
   }
 
-  for( i = 0; i < uNumSpriteObjects; ++i) 
+  for( uint i = 0; i < uNumSpriteObjects; ++i) 
   {
     if (pSpriteObjects[i].uAttributes & 4)
       pSpriteObjects[i].uAttributes &= ~0x04;
@@ -272,9 +272,9 @@
   Actor *curr_actor; // [sp+58h] [bp-14h]@2
   int target_pid; // [sp+5Ch] [bp-10h]@6
   int shrinked;
-  int i, j;
+  int j;
 
-  for (i = 0; i < uNumActors; ++i )
+  for (uint i = 0; i < uNumActors; ++i )
   {
     curr_actor=&pActors[i];
     shrinked=pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0;
@@ -302,7 +302,7 @@
           curr_actor->uAIState = Dead;
           curr_actor->UpdateAnimation();
         }
-        else  if ( (curr_actor->uAIState > AIState::Removed) && (curr_actor->uAIState < AIState::Disabled))
+        else  if ( (curr_actor->uAIState > Removed) && (curr_actor->uAIState < Disabled))
           Actor::AI_StandOrBored(i, target_pid, 32, &v14);
       }
     }
@@ -444,24 +444,24 @@
       if (PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor)
       {
         monster_id = PID_ID(pQueue[i].uPackedID);
-        if ( (pActors[monster_id].uAIState == AIState::Dying) || (pActors[monster_id].uAIState == AIState::Stunned)
-          || (pActors[monster_id].uAIState == AIState::AttackingMelee) || (pActors[monster_id].uAIState == AIState::AttackingRanged1)
-          || (pActors[monster_id].uAIState == AIState::AttackingRanged2) || (pActors[monster_id].uAIState == AIState::AttackingRanged3)
-          || (pActors[monster_id].uAIState == AIState::AttackingRanged4) || (pActors[monster_id].uAIState ==AIState::Summoned))
+        if ( (pActors[monster_id].uAIState == Dying) || (pActors[monster_id].uAIState == Stunned)
+          || (pActors[monster_id].uAIState == AttackingMelee) || (pActors[monster_id].uAIState == AttackingRanged1)
+          || (pActors[monster_id].uAIState == AttackingRanged2) || (pActors[monster_id].uAIState == AttackingRanged3)
+          || (pActors[monster_id].uAIState == AttackingRanged4) || (pActors[monster_id].uAIState == Summoned))
         {
           pActors[monster_id].uCurrentActionTime += pEventTimer->uTimeElapsed;
           if ( pActors[monster_id].uCurrentActionTime < pActors[monster_id].uCurrentActionLength )
             v13 = 1;
-          else if ( pActors[monster_id].uAIState == AIState::Dying )// Dying
+          else if ( pActors[monster_id].uAIState == Dying )// Dying
           {
-            pActors[monster_id].uAIState = AIState::Dead;
+            pActors[monster_id].uAIState = Dead;
             pActors[monster_id].uCurrentActionTime = 0;
             pActors[monster_id].uCurrentActionLength = 0;
             pActors[monster_id].UpdateAnimation();
           }
           else
           {
-            if ( pActors[monster_id].uAIState == AIState::Stunned ) //Stunned
+            if ( pActors[monster_id].uAIState == Stunned ) //Stunned
               Actor::AI_StandOrBored(monster_id, ai_near_actors_targets_pid[monster_id], 32, 0);
           }
         }
@@ -481,9 +481,9 @@
     if(PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor) 
     {
       monster_id = PID_ID(pQueue[i].uPackedID);
-      if ((pActors[monster_id].uAIState != AIState::Dead) && (pActors[monster_id].uAIState != AIState::Dying) &&
-          (pActors[monster_id].uAIState != AIState::Removed) && (pActors[monster_id].uAIState != AIState::Summoned) &&
-          (pActors[monster_id].uAIState != AIState::Disabled))
+      if ((pActors[monster_id].uAIState != Dead) && (pActors[monster_id].uAIState != Dying) &&
+          (pActors[monster_id].uAIState != Removed) && (pActors[monster_id].uAIState != Summoned) &&
+          (pActors[monster_id].uAIState != Disabled))
       {
         pQueue[i].uActionLength = 0;
         Actor::AI_StandOrBored(monster_id, ai_near_actors_targets_pid[monster_id], 32, nullptr);
@@ -524,8 +524,8 @@
       if ( pQueue[0].actor_initiative > 0 )
       {
         v9 = pActors[PID_ID(pQueue[0].uPackedID)].uAIState;
-        if (!(v9 == AIState::Dying || v9 == AIState::Dead || 
-              v9 == AIState::Disabled || v9 == AIState::Removed))
+        if (!(v9 == Dying || v9 == Dead || 
+              v9 == Disabled || v9 == Removed))
         {
           do
           {
@@ -601,9 +601,9 @@
         break;
       monster=&pActors[PID_ID(pQueue[i].uPackedID)];
       monster_ai_state=monster->uAIState;
-      if (monster_ai_state == AIState::Standing || 
-          monster_ai_state == AIState::Fleeing || 
-          monster_ai_state == AIState::Fidgeting)
+      if (monster_ai_state == Standing || 
+          monster_ai_state == Fleeing || 
+          monster_ai_state == Fidgeting)
       {
         pQueue[i].actor_initiative = pMonsterStats->pInfos[monster->pMonsterInfo.uID].uRecoveryTime;
         if (monster->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0)
@@ -666,42 +666,42 @@
     memcpy(&a4, &a3, sizeof(a4));
     //v5 = &pActors[v4];
     //LOWORD(v3) = v5->uAIState;
-    if (( pActors[actor_id].uAIState != AIState::Dead ) && ( pActors[actor_id].uAIState != AIState::Disabled )
-      &&( pActors[actor_id].uAIState != AIState::Removed ))
+    if (( pActors[actor_id].uAIState != Dead ) && ( pActors[actor_id].uAIState != Disabled )
+      &&( pActors[actor_id].uAIState != Removed ))
     {
       pActors[actor_id].uCurrentActionTime += pEventTimer->uTimeElapsed;
       if ( (signed int)pActors[actor_id].uCurrentActionTime >= pActors[actor_id].uCurrentActionLength )
       {
         switch (pActors[actor_id].uAIState)
         {
-          case  AIState::AttackingMelee:
+          case  AttackingMelee:
             v19 = pActors[actor_id].special_ability_use_check(actor_id);
             AttackerInfo.Add( pQueue[queue_index].uPackedID,  5120,  pActors[actor_id].vPosition.x, pActors[actor_id].vPosition.y,
                               pActors[actor_id].vPosition.z + ((signed int)pActors[actor_id].uActorHeight >> 1), v19,  1);
             Actor::AI_Stand(actor_id, ai_near_actors_targets_pid[actor_id], 0, &a4);
             break;
-          case AIState::AttackingRanged1:
+          case AttackingRanged1:
             Actor::AI_RangedAttack(actor_id, &a4, pActors[actor_id].pMonsterInfo.uMissleAttack1Type, 0);
             Actor::AI_Stand(actor_id, ai_near_actors_targets_pid[actor_id], 0,&a4);
             break;
-          case AIState::Dying:
+          case Dying:
             pActors[actor_id].uCurrentActionTime = 0;
             pActors[actor_id].uCurrentActionLength = 0;
             pActors[actor_id].uAIState = Dead;
             pActors[actor_id].UpdateAnimation();
             break;
-          case AIState::Stunned:
+          case Stunned:
             Actor::AI_Stand(actor_id, ai_near_actors_targets_pid[actor_id], 0,&a4);
             break;
-          case AIState::AttackingRanged2:
+          case AttackingRanged2:
             Actor::AI_RangedAttack(actor_id, &a4, pActors[actor_id].pMonsterInfo.uMissleAttack2Type, 1);
             Actor::AI_Stand(actor_id, ai_near_actors_targets_pid[actor_id], 0,&a4);
             break;
-          case AIState::AttackingRanged3:
+          case AttackingRanged3:
             Actor::AI_SpellAttack(actor_id, &a4, pActors[actor_id].pMonsterInfo.uSpell1ID, 2, pActors[actor_id].pMonsterInfo.uSpellSkillAndMastery1);
             Actor::AI_Stand(actor_id, ai_near_actors_targets_pid[actor_id], 0, &a4);
             break;
-          case AIState::AttackingRanged4:
+          case AttackingRanged4:
             Actor::AI_SpellAttack(actor_id, &a4, pActors[actor_id].pMonsterInfo.uSpell2ID, 3, pActors[actor_id].pMonsterInfo.uSpellSkillAndMastery2);
             Actor::AI_Stand(actor_id, ai_near_actors_targets_pid[actor_id], 0, &a4);
             break;
@@ -733,8 +733,8 @@
   if (PID_TYPE(pQueue[queue_index].uPackedID) == OBJECT_Actor)
   {
     actor_id = PID_ID(pQueue[queue_index].uPackedID);
-    if (!(pActors[actor_id].uAIState == AIState::Dying || pActors[actor_id].uAIState == AIState::Dead || pActors[actor_id].uAIState == AIState::Summoned ||
-          pActors[actor_id].uAIState == AIState::Disabled || pActors[actor_id].uAIState == AIState::Removed))
+    if (!(pActors[actor_id].uAIState == Dying || pActors[actor_id].uAIState == Dead || pActors[actor_id].uAIState == Summoned ||
+          pActors[actor_id].uAIState == Disabled || pActors[actor_id].uAIState == Removed))
     {
       Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true);
       v22 = ai_near_actors_targets_pid[actor_id];
@@ -891,11 +891,11 @@
     {
       monster_id = PID_ID(pQueue[i].uPackedID);
       if ( !(pActors[monster_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0|| (pActors[monster_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0) || 
-             pActors[monster_id].uAIState == AIState::Dead || pActors[monster_id].uAIState == AIState::Removed || pActors[monster_id].uAIState == AIState::Disabled) )
+             pActors[monster_id].uAIState == Dead || pActors[monster_id].uAIState == Removed || pActors[monster_id].uAIState == Disabled) )
       {
         v13 = ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)];
         Actor::GetDirectionInfo(pQueue[i].uPackedID, v13, &v9, 0);
-        if ( pActors[monster_id].uAIState == AIState::Pursuing || pActors[monster_id].uAIState == AIState::Tethered ) 
+        if ( pActors[monster_id].uAIState == Pursuing || pActors[monster_id].uAIState == Tethered ) 
         {
           if ( (double)(signed int)v9.uDistance < 307.2 )
             Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), v13, 32, &v9);
@@ -905,11 +905,11 @@
           pActors[monster_id].uCurrentActionTime += pEventTimer->uTimeElapsed;
           if ( pActors[monster_id].uCurrentActionTime > pActors[monster_id].uCurrentActionLength )
           {
-            if ( pActors[monster_id].uAIState == AIState::Dying )
+            if ( pActors[monster_id].uAIState == Dying )
             {
               pActors[monster_id].uCurrentActionTime = 0;
               pActors[monster_id].uCurrentActionLength = 0;
-              pActors[monster_id].uAIState = AIState::Dead;
+              pActors[monster_id].uAIState = Dead;
               pActors[monster_id].UpdateAnimation();
             }
             if ( !ActorMove(i) )
@@ -934,9 +934,9 @@
   if (PID_TYPE(pQueue[queue_position].uPackedID) == OBJECT_Player)
     return 0;
   uActorID = PID_ID(pQueue[queue_position].uPackedID);
-  if ( pActors[uActorID].uAIState == AIState::Dead || pActors[uActorID].uAIState ==  AIState::Dying || 
-       pActors[uActorID].uAIState == AIState::Removed|| pActors[uActorID].uAIState == AIState::Disabled || 
-       pActors[uActorID].uAIState == AIState::Summoned  )
+  if ( pActors[uActorID].uAIState == Dead || pActors[uActorID].uAIState ==  Dying || 
+       pActors[uActorID].uAIState == Removed|| pActors[uActorID].uAIState == Disabled || 
+       pActors[uActorID].uAIState == Summoned  )
     return 1;
   Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true);
   if ( pActors[uActorID].pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[uActorID] )
@@ -1074,8 +1074,8 @@
     {
       uActorID=PID_ID(pQueue[i].uPackedID);
       curr_acror = &pActors[uActorID];
-      if ( !( curr_acror->uAIState == AIState::Summoned|| curr_acror->uAIState == AIState::Dead ||
-              curr_acror->uAIState == AIState::Removed || curr_acror->uAIState == AIState::Disabled) )
+      if ( !( curr_acror->uAIState == Summoned|| curr_acror->uAIState == Dead ||
+              curr_acror->uAIState == Removed || curr_acror->uAIState == Disabled) )
       {
         target_pid = ai_near_actors_targets_pid[uActorID];
         Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true);
@@ -1084,11 +1084,11 @@
         curr_acror->uCurrentActionTime += pEventTimer->uTimeElapsed;
         if ( curr_acror->uCurrentActionTime > curr_acror->uCurrentActionLength )
         {
-          if ( curr_acror->uAIState == AIState::Dying )
+          if ( curr_acror->uAIState == Dying )
           {
             curr_acror->uCurrentActionTime = 0;
             curr_acror->uCurrentActionLength = 0;
-            curr_acror->uAIState = AIState::Dead;
+            curr_acror->uAIState = Dead;
             curr_acror->UpdateAnimation();
             break;
           }
--- a/VideoPlayer.cpp	Tue Jul 22 23:07:24 2014 +0200
+++ b/VideoPlayer.cpp	Wed Jul 23 16:06:17 2014 +0600
@@ -284,8 +284,8 @@
   pRenderer->BeginScene();
   if (end_current_file)//видео завершено/перезагрузка
   {
-    int width = game_viewport_width;
-    int height = game_viewport_height;
+    unsigned int width = game_viewport_width;
+    unsigned int height = game_viewport_height;
 	MovieRelease();
 
     SetFilePointer(hVidFile, uOffset, nullptr, FILE_BEGIN);
@@ -355,7 +355,10 @@
 //----- (004BF3F9) --------------------------------------------------------
 bool VideoPlayer::AnyMovieLoaded()
 {
+  if (pMovie_Track)
 	return pMovie_Track;// pSmackerMovie || pBinkMovie;
+  else
+	  return false;
 }
 
 //----- (004BF411) --------------------------------------------------------
--- a/mm7_2.cpp	Tue Jul 22 23:07:24 2014 +0200
+++ b/mm7_2.cpp	Wed Jul 23 16:06:17 2014 +0600
@@ -1211,10 +1211,9 @@
 //----- (00464E17) --------------------------------------------------------
 bool __fastcall CheckMM7CD(char c)
 {
-  char DstBuf[256]; // [sp+Ch] [bp-218h]@1
-  char strCommand[256]; // [sp+10Ch] [bp-118h]@1
-  char Filename[20]; // [sp+20Ch] [bp-18h]@1
-
+  char DstBuf[256] = {0};
+  char strCommand[256] = {0}; // [sp+10Ch] [bp-118h]@1
+  char Filename[20] = {0}; // [sp+20Ch] [bp-18h]@1
 
   wchar_t pMagicPath[1024];
   swprintf(pMagicPath, wcslen(L"%C:\\anims\\magic7.vid"), L"%C:\\anims\\magic7.vid", c);
@@ -1222,12 +1221,13 @@
     return false;
 
   wsprintfA(strCommand, "open %c: type cdaudio alias CD", c);
-  if (!mciSendStringA(strCommand, DstBuf, 0xFFu, 0))
+  if (!mciSendStringA(strCommand, DstBuf, 255, 0))//Uninitialized memory access
+
   {
     wsprintfA(strCommand, "info CD UPC wait");
-    mciSendStringA(strCommand, DstBuf, 0xFFu, 0);
+    mciSendStringA(strCommand, DstBuf, 255, 0);
     wsprintfA(strCommand, "close CD");
-    mciSendStringA(strCommand, DstBuf, 0xFFu, 0);
+    mciSendStringA(strCommand, DstBuf, 255, 0);
   }
 
   memcpy(Filename, "X:\\anims\\magic7.vid", sizeof(Filename));
@@ -1240,7 +1240,7 @@
   if (!fseek(f, 0, SEEK_END))
   {
     if (!fseek(f, -100, SEEK_CUR))
-      fread(DstBuf, 1u, 0x64u, f);
+      fread(DstBuf, 1, 0x64u, f);
 
     fclose(f);
     return true;
@@ -2423,10 +2423,10 @@
 //  unsigned int v23; // eax@46
   signed int v24; // ebx@46
   char *v25; // edx@47
-  int v26; // edx@54
-  int v27; // edx@55
-  int v28; // edx@56
-  int v29; // edx@57
+//  int v26; // edx@54
+//  int v27; // edx@55
+//  int v28; // edx@56
+//  int v29; // edx@57
 //  unsigned __int16 v30; // ax@60
 //  unsigned int v31; // ecx@60
 //  int v32; // edi@60
@@ -2438,16 +2438,16 @@
   int v38; // eax@72
   int v39; // ST10_4@72
   int v40; // ST0C_4@72
-  int v41; // edx@76
-  int v42; // edx@77
-  int v43; // edx@78
+  //int v41; // edx@76
+//  int v42; // edx@77
+//  int v43; // edx@78
   unsigned __int8 v44; // zf@79
-  int v45; // edx@79
-  unsigned __int16 v46; // ax@80
+//  int v45; // edx@79
+//  unsigned __int16 v46; // ax@80
   int v47; // eax@81
-  int v48; // edx@87
-  int v49; // edx@88
-  int v50; // edx@89
+//  int v48; // edx@87
+//  int v49; // edx@88
+//  int v50; // edx@89
   signed int v52; // ebx@93
 //  char *v53; // edx@94
 //  unsigned __int16 v54; // ax@98
@@ -2470,7 +2470,7 @@
   unsigned __int16 v71; // ax@128
   unsigned int v72; // ebx@131
   int v78; // eax@133
-  char v79; // zf@139
+//  char v79; // zf@139
 //  unsigned int v80; // eax@140
   signed int v81; // edx@140
 //  char *v82; // ecx@141
--- a/mm7_data.cpp	Tue Jul 22 23:07:24 2014 +0200
+++ b/mm7_data.cpp	Wed Jul 23 16:06:17 2014 +0600
@@ -308,8 +308,8 @@
 // Data declarations
 
 int game_starting_year = 0;
-int game_viewport_width;
-int game_viewport_height;
+unsigned int game_viewport_width;
+unsigned int game_viewport_height;
 int game_viewport_x;
 int game_viewport_y;
 int game_viewport_z;
--- a/mm7_data.h	Tue Jul 22 23:07:24 2014 +0200
+++ b/mm7_data.h	Wed Jul 23 16:06:17 2014 +0600
@@ -288,8 +288,8 @@
 // Data declarations
 
 extern int game_starting_year;
-extern int game_viewport_width;
-extern int game_viewport_height;
+extern unsigned int game_viewport_width;
+extern unsigned int game_viewport_height;
 extern int game_viewport_x;
 extern int game_viewport_y;
 extern int game_viewport_z;
--- a/stru6.cpp	Tue Jul 22 23:07:24 2014 +0200
+++ b/stru6.cpp	Wed Jul 23 16:06:17 2014 +0600
@@ -1419,26 +1419,11 @@
 {
   double v4; // st7@4
   double v5; // st6@4
-  //double v6; // st7@4
   float v7; // ST14_4@6
   unsigned int v8; // ST14_4@8
-  unsigned int v9; // eax@8
   SpriteFrame *v10; // eax@8
   int v11; // edi@8
-  double v12; // st7@9
-  double v13; // st7@9
-  double v14; // st7@9
-  double v15; // st6@9
-//  HRESULT v16; // eax@9
-//  HRESULT v17; // eax@9
-//  signed __int64 v18; // qtt@10
-//  const char *v19; // [sp+4h] [bp-E8h]@0
-//  int v20; // [sp+8h] [bp-E4h]@0
-//  unsigned int v21; // [sp+Ch] [bp-E0h]@0
   RenderVertexD3D3 vd3d[4]; // [sp+60h] [bp-8Ch]@9
-//  int v24; // [sp+E0h] [bp-Ch]@10
-  SpriteFrame *v70; // [sp+E4h] [bp-8h]@8
-  unsigned int v26; // [sp+E8h] [bp-4h]@3
 
   if (uNumProjectiles)
   {
@@ -1459,58 +1444,52 @@
     uFadeTime -= pEventTimer->uTimeElapsed;
   }
 
-  if (uAnimLength > 0) //Uninitialized memory access
+  if (uAnimLength > 0)
   {
-    v8 = 8
-       * pSpriteFrameTable->pSpriteSFrames[pSpriteFrameTable->FastFindSprite("spell84")].uAnimLength
-       - uAnimLength;
-    v9 = pSpriteFrameTable->FastFindSprite("spell84");
-    v10 = pSpriteFrameTable->GetFrame(v9, v8);
+    v8 = 8 * pSpriteFrameTable->pSpriteSFrames[pSpriteFrameTable->FastFindSprite("spell84")].uAnimLength - uAnimLength;
+    v10 = pSpriteFrameTable->GetFrame(pSpriteFrameTable->FastFindSprite("spell84"), v8);
     v11 = v10->pHwSpriteIDs[0];
-    v70 = v10;
     uAnimLength -= pEventTimer->uTimeElapsed;
     //if ( pRenderer->pRenderD3D )
-    {
-      v12 = (double)(signed int)pViewport->uViewportTL_X;
-      vd3d[0].pos.x = v12;
-      vd3d[1].pos.x = v12;
-      v13 = (double)(signed int)pViewport->uViewportBR_X;
-      v26 = pViewport->uViewportBR_Y + 1;
+    //{
+      vd3d[0].pos.x = (double)(signed int)pViewport->uViewportTL_X;
+      vd3d[0].pos.y = (double)(signed int)pViewport->uViewportTL_Y;
+      vd3d[0].pos.z = 0.0;
       vd3d[0].diffuse = 0x7F7F7Fu;
+      vd3d[0].specular = 0;
+      vd3d[0].rhw = 1.0;
+      vd3d[0].texcoord.x = 0.0;
+      vd3d[0].texcoord.y = 0.0;
+
+      vd3d[1].pos.x = (double)(signed int)pViewport->uViewportTL_X;
+      vd3d[1].pos.y = (double)(pViewport->uViewportBR_Y + 1);
+      vd3d[1].pos.z = 0.0;
       vd3d[1].diffuse = 0x7F7F7Fu;
-      vd3d[2].pos.x = v13;
-      vd3d[3].pos.x = v13;
-      v14 = (double)(signed int)pViewport->uViewportTL_Y;
+      vd3d[1].specular = 0;
+      vd3d[1].rhw = 1.0;
+      vd3d[1].texcoord.x = 0.0;
+      vd3d[1].texcoord.y = 1.0;
+
+      vd3d[2].pos.x = (double)(signed int)pViewport->uViewportBR_X;
+      vd3d[2].pos.y = (double)(pViewport->uViewportBR_Y + 1);
+      vd3d[2].pos.z = 0.0;
       vd3d[2].diffuse = 0x7F7F7Fu;
+      vd3d[2].specular = 0;
+      vd3d[2].rhw = 1.0;
+      vd3d[2].texcoord.x = 1.0;
+      vd3d[2].texcoord.y = 1.0;
+
+      vd3d[3].pos.x = (double)(signed int)pViewport->uViewportBR_X;
+      vd3d[3].pos.y = (double)(signed int)pViewport->uViewportTL_Y;
+      vd3d[3].pos.z = 0.0;
       vd3d[3].diffuse = 0x7F7F7Fu;
-      vd3d[0].specular = 0;
-      vd3d[1].specular = 0;
-      vd3d[0].pos.y = v14;
-      v15 = (double)(pViewport->uViewportBR_Y + 1);
-      vd3d[2].specular = 0;
       vd3d[3].specular = 0;
-      vd3d[1].pos.y = v15;
-      vd3d[2].pos.y = v15;
-      vd3d[3].pos.y = v14;
-      vd3d[0].pos.z = 0.0;
-      vd3d[1].pos.z = 0.0;
-      vd3d[2].pos.z = 0.0;
-      vd3d[3].pos.z = 0.0;
-      vd3d[0].rhw = 1.0;
-      vd3d[1].rhw = 1.0;
-      vd3d[2].rhw = 1.0;
       vd3d[3].rhw = 1.0;
-      vd3d[0].texcoord.x = 0.0;
-      vd3d[1].texcoord.x = 0.0;
-      vd3d[2].texcoord.x = 1.0;
       vd3d[3].texcoord.x = 1.0;
-      vd3d[0].texcoord.y = 0.0;
-      vd3d[1].texcoord.y = 1.0;
-      vd3d[2].texcoord.y = 1.0;
       vd3d[3].texcoord.y = 0.0;
 
       pRenderer->DrawSpecialEffectsQuad(vd3d, pSprites_LOD->pHardwareSprites[v11].pTexture);
-    }
+    //}
     /*else
     {
       vsr.pTarget = pRenderer->pTargetSurface;
--- a/stru6.h	Tue Jul 22 23:07:24 2014 +0200
+++ b/stru6.h	Wed Jul 23 16:06:17 2014 +0600
@@ -105,6 +105,7 @@
     this->uFadeTime = 0;
     this->uNumProjectiles = 0;
     this->field_0 = 0;
+	this->uAnimLength = 0;
 
     pStru1 = new stru6_stru1_indoor_sw_billboard;
     pStru1->Initialize(0xFF3C1Eu);