diff Engine/Engine.cpp @ 2572:d87bfbd3bb3b

Step towards unification of Texture and RGBTexture (class Image)
author a.parshin
date Sat, 05 Mar 2016 01:51:54 +0200
parents d433439699be
children dd36326a9994
line wrap: on
line diff
--- a/Engine/Engine.cpp	Mon Oct 05 00:19:13 2015 +0200
+++ b/Engine/Engine.cpp	Sat Mar 05 01:51:54 2016 +0200
@@ -999,7 +999,7 @@
     static_assert(sizeof(LevelDecoration) == 0x20, "Wrong type size");
     static_assert(sizeof(KeyboardActionMapping) == 0x20C, "Wrong type size");
     static_assert(sizeof(UIAnimation) == 0xD, "Wrong type size");
-    static_assert(sizeof(SpawnPointMM7) == 0x18, "Wrong type size");
+    //static_assert(sizeof(SpawnPointMM7) == 0x18, "Wrong type size");
     static_assert(sizeof(ODMFace) == 0x134, "Wrong type size");
     static_assert(sizeof(BSPNode) == 0x8, "Wrong type size");
     static_assert(sizeof(BSPModel) == 0xBC, "Wrong type size");
@@ -1075,7 +1075,7 @@
     static_assert(sizeof(LevelDecoration) == 32, "Wrong type size");
     static_assert(sizeof(BLVLightMM7) == 16, "Wrong type size");
     static_assert(sizeof(BSPNode) == 8, "Wrong type size");
-    static_assert(sizeof(SpawnPointMM7) == 24, "Wrong type size");
+    //static_assert(sizeof(SpawnPointMM7) == 24, "Wrong type size");
     static_assert(sizeof(DDM_DLV_Header) == 40, "Wrong type size");
     static_assert(sizeof(Actor) == 836, "Wrong type size");
     static_assert(sizeof(SpriteObject) == 112, "Wrong type size");
@@ -1372,7 +1372,7 @@
             L"Files Missing", MB_ICONEXCLAMATION);
         return false;
     }
-    pIcons_LOD->dword_011BA4 = 0;
+    pIcons_LOD->_011BA4_debug_paletted_pixels_uncompressed = false;
 
     pEvents_LOD = new LODFile_IconsBitmaps;
     if (!pEvents_LOD->Load("data\\events.lod", "icons"))
@@ -1745,6 +1745,35 @@
 bool use_music_folder = false;
 bool for_refactoring = false;
 bool all_spells = true;
+bool bNoMargareth = false;
+
+void ParseCommandLine(const wchar_t *cmd)
+{
+    //if (wcsstr(pCmdLine, L"-usedefs"))
+    //  bDebugResouces = 1;
+    if (wcsstr(cmd, L"-window"))
+        dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW;
+
+    if (wcsstr(cmd, L"-nointro"))
+        bNoIntro = true;//dword_6BE364_game_settings_1 |= 4;
+    if (wcsstr(cmd, L"-nologo"))
+        bNoLogo = true;//dword_6BE364_game_settings_1 |= 8;
+    if (wcsstr(cmd, L"-nosound"))
+        bNoSound = true; //dword_6BE364_game_settings_1 |= 0x10;
+
+    bWalkSound = ReadWindowsRegistryInt("WalkSound", 1) != 0;
+    if (wcsstr(cmd, L"-nowalksound"))
+        bWalkSound = false;//dword_6BE364_game_settings_1 |= 0x20;
+    if (wcsstr(cmd, L"-novideo"))
+    {
+        dword_6BE364_game_settings_1 |= GAME_SETTINGS_NO_HOUSE_ANIM;
+        bNoVideo = true;
+    }
+    if (wcsstr(cmd, L"-nocd"))
+        bNoCD = true;
+    if (wcsstr(cmd, L"-nomarg"))
+        bNoMargareth = true;
+}
 
 //----- (00462C94) --------------------------------------------------------
 bool MM_Main(const wchar_t *pCmdLine)
@@ -1754,36 +1783,8 @@
     lua = new LuaVM;
     lua->Initialize();
 
-    bool bNoMargareth = false;
     if (pCmdLine && *pCmdLine)
-    {
-        //if (wcsstr(pCmdLine, L"-usedefs"))
-        //  bDebugResouces = 1;
-        if (wcsstr(pCmdLine, L"-window"))
-            dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW;
-
-        if (wcsstr(pCmdLine, L"-nointro"))
-            bNoIntro = true;//dword_6BE364_game_settings_1 |= 4;
-        if (wcsstr(pCmdLine, L"-nologo"))
-            bNoLogo = true;//dword_6BE364_game_settings_1 |= 8;
-        if (wcsstr(pCmdLine, L"-nosound"))
-            bNoSound = true; //dword_6BE364_game_settings_1 |= 0x10;
-
-        bWalkSound = ReadWindowsRegistryInt("WalkSound", 1) != 0;
-        if (wcsstr(pCmdLine, L"-nowalksound"))
-            bWalkSound = false;//dword_6BE364_game_settings_1 |= 0x20;
-        if (wcsstr(pCmdLine, L"-novideo"))
-        {
-            dword_6BE364_game_settings_1 |= GAME_SETTINGS_NO_HOUSE_ANIM;
-            bNoVideo = true;
-        }
-        if (wcsstr(pCmdLine, L"-nocd"))
-            bNoCD = true;
-        if (wcsstr(pCmdLine, L"-nomarg"))
-            bNoMargareth = true;
-    }
-
-    //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF );//Ritor1: for memory test
+        ParseCommandLine(pCmdLine);
 
     if (!MM7_Initialize(640, 480))
     {
@@ -1794,21 +1795,16 @@
 
     pEventTimer->Pause();
 
-    SetUserInterface(PartyAlignment_Neutral, false);
-
-    for (uint i = 0; i < 20; ++i)
-        pWindowList[i] = nullptr;
-    uNumVisibleWindows = -1;
-    memset(pVisibleWindowsIdxs.data(), 0, sizeof(pVisibleWindowsIdxs));
+    GUIWindow::InitializeGUI();
+
 
     ShowLogoVideo();
     //ShowIntroVideo_and_LoadingScreen();
-    WriteWindowsRegistryInt("Ran once", 1);
+
     dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
 
-    //Ritor1: include
-    if (use_MMT)
-        MMT_MainMenu_Loop();
+    //if (use_MMT)
+    //    MMT_MainMenu_Loop();
 
     Log::Warning(L"MM: entering main loop");
     while (1)
@@ -1840,6 +1836,9 @@
                 if (!CreateParty_Loop())
                     break;
 
+
+                pParty->pPickedItem.uItemID = 0;
+
                 strcpy(pCurrentMapName, pStartingMapName);
                 bFlashQuestBook = true;
                 pMediaPlayer->PlayFullscreenMovie(MOVIE_Emerald, true);
@@ -1914,22 +1913,6 @@
                 break;
             }
         }
-        if (!bNoSound)
-        {
-            if (use_music_folder)
-            {
-                PlayAudio(L"Music\\14.mp3");
-                alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
-            }
-            else if (pAudioPlayer->hAILRedbook)
-            {
-                pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
-                AIL_redbook_stop(pAudioPlayer->hAILRedbook);
-                unsigned int startms, end_ms;
-                AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &startms, &end_ms);
-                AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms);
-            }
-        }
     }
     //lua_close(L);
     pEngine->Deinitialize();