changeset 2427:94393b73d333

* Some initialization stuff
author a.parshin
date Wed, 23 Jul 2014 13:28:30 +0300
parents 255168c31655
children c99c99439f6c
files MMT.cpp Registry.cpp mm7_2.cpp
diffstat 3 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MMT.cpp	Wed Jul 23 12:58:30 2014 +0300
+++ b/MMT.cpp	Wed Jul 23 13:28:30 2014 +0300
@@ -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");
 
@@ -215,7 +215,9 @@
   pTexture_PCX.Release();
 
   sprintf(pContainerName, "data\\New_Icons/%s", "MMTTITLE.pcx");//загружаем pcx из папки
-  pTexture_PCX.LoadPCXFile(pContainerName, 0);
+  if (pTexture_PCX.LoadPCXFile(pContainerName, 0) == 1)
+	  Error("File not found: %s", pContainerName);
+
   SetCurrentMenuID(MENU_MMT_MAIN_MENU);//Добавлено в enum MENU_STATE в GUIWindows.h
   SetForegroundWindow(window->GetApiHandle());
   SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0);
--- a/Registry.cpp	Wed Jul 23 12:58:30 2014 +0300
+++ b/Registry.cpp	Wed Jul 23 13:28:30 2014 +0300
@@ -8,11 +8,11 @@
 #include <windows.h>
 
 #include "Registry.h"
+#include "ErrorHandling.h"
 
 //----- (004649EF) --------------------------------------------------------
 int __fastcall ReadWindowsRegistryInt(const char *pKey, int uDefValue)
 {
-  int v3; // [sp+4h] [bp-24h]@1
   DWORD cbData; // [sp+8h] [bp-20h]@1
   LPCSTR lpValueName; // [sp+Ch] [bp-1Ch]@1
   DWORD dwDisposition; // [sp+10h] [bp-18h]@2
@@ -22,7 +22,6 @@
   HKEY v10; // [sp+20h] [bp-8h]@1
   HKEY v11; // [sp+24h] [bp-4h]@1
 
-  v3 = uDefValue;
   lpValueName = pKey;
   v11 = 0;
   v10 = 0;
@@ -37,9 +36,13 @@
       {
         if ( !RegCreateKeyExA(v10, "1.0", 0, "", 0, 0xF003Fu, 0, &v11, &dwDisposition) )
         {
-          if ( RegQueryValueExA(v11, lpValueName, 0, 0, Data, &cbData) )
+			LSTATUS status;
+          if ( status = RegQueryValueExA(v11, lpValueName, 0, 0, Data, &cbData) )
           {
-            *(int *)Data = v3;
+			  status;			  
+			  GetLastError();
+
+            *(int *)Data = uDefValue;
             RegSetValueExA(v11, lpValueName, 0, 4u, Data, 4u);
           }
           RegCloseKey(v11);
--- a/mm7_2.cpp	Wed Jul 23 12:58:30 2014 +0300
+++ b/mm7_2.cpp	Wed Jul 23 13:28:30 2014 +0300
@@ -1719,7 +1719,7 @@
   else
     pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS;
 
-  uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0);
+  uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 3);
 
   if (!bNoSound)
     pAudioPlayer->Initialize();