Mercurial > mm7
comparison 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 |
comparison
equal
deleted
inserted
replaced
2571:cf29f444ddd7 | 2572:d87bfbd3bb3b |
---|---|
997 static_assert(sizeof(ActorJob) == 0xC, "Wrong type size"); | 997 static_assert(sizeof(ActorJob) == 0xC, "Wrong type size"); |
998 static_assert(sizeof(Actor) == 0x344, "Wrong type size"); | 998 static_assert(sizeof(Actor) == 0x344, "Wrong type size"); |
999 static_assert(sizeof(LevelDecoration) == 0x20, "Wrong type size"); | 999 static_assert(sizeof(LevelDecoration) == 0x20, "Wrong type size"); |
1000 static_assert(sizeof(KeyboardActionMapping) == 0x20C, "Wrong type size"); | 1000 static_assert(sizeof(KeyboardActionMapping) == 0x20C, "Wrong type size"); |
1001 static_assert(sizeof(UIAnimation) == 0xD, "Wrong type size"); | 1001 static_assert(sizeof(UIAnimation) == 0xD, "Wrong type size"); |
1002 static_assert(sizeof(SpawnPointMM7) == 0x18, "Wrong type size"); | 1002 //static_assert(sizeof(SpawnPointMM7) == 0x18, "Wrong type size"); |
1003 static_assert(sizeof(ODMFace) == 0x134, "Wrong type size"); | 1003 static_assert(sizeof(ODMFace) == 0x134, "Wrong type size"); |
1004 static_assert(sizeof(BSPNode) == 0x8, "Wrong type size"); | 1004 static_assert(sizeof(BSPNode) == 0x8, "Wrong type size"); |
1005 static_assert(sizeof(BSPModel) == 0xBC, "Wrong type size"); | 1005 static_assert(sizeof(BSPModel) == 0xBC, "Wrong type size"); |
1006 static_assert(sizeof(OutdoorLocation) == 0x1C28C, "Wrong type size"); | 1006 static_assert(sizeof(OutdoorLocation) == 0x1C28C, "Wrong type size"); |
1007 static_assert(sizeof(BLVFace) == 0x60, "Wrong type size"); | 1007 static_assert(sizeof(BLVFace) == 0x60, "Wrong type size"); |
1073 static_assert(sizeof(BLVFaceExtra) == 36, "Wrong type size"); | 1073 static_assert(sizeof(BLVFaceExtra) == 36, "Wrong type size"); |
1074 static_assert(sizeof(BLVSector) == 116, "Wrong type size"); | 1074 static_assert(sizeof(BLVSector) == 116, "Wrong type size"); |
1075 static_assert(sizeof(LevelDecoration) == 32, "Wrong type size"); | 1075 static_assert(sizeof(LevelDecoration) == 32, "Wrong type size"); |
1076 static_assert(sizeof(BLVLightMM7) == 16, "Wrong type size"); | 1076 static_assert(sizeof(BLVLightMM7) == 16, "Wrong type size"); |
1077 static_assert(sizeof(BSPNode) == 8, "Wrong type size"); | 1077 static_assert(sizeof(BSPNode) == 8, "Wrong type size"); |
1078 static_assert(sizeof(SpawnPointMM7) == 24, "Wrong type size"); | 1078 //static_assert(sizeof(SpawnPointMM7) == 24, "Wrong type size"); |
1079 static_assert(sizeof(DDM_DLV_Header) == 40, "Wrong type size"); | 1079 static_assert(sizeof(DDM_DLV_Header) == 40, "Wrong type size"); |
1080 static_assert(sizeof(Actor) == 836, "Wrong type size"); | 1080 static_assert(sizeof(Actor) == 836, "Wrong type size"); |
1081 static_assert(sizeof(SpriteObject) == 112, "Wrong type size"); | 1081 static_assert(sizeof(SpriteObject) == 112, "Wrong type size"); |
1082 static_assert(sizeof(Chest) == 5324, "Wrong type size"); | 1082 static_assert(sizeof(Chest) == 5324, "Wrong type size"); |
1083 static_assert(sizeof(stru123) == 0xC8, "Wrong type size"); | 1083 static_assert(sizeof(stru123) == 0xC8, "Wrong type size"); |
1370 { | 1370 { |
1371 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.", | 1371 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.", |
1372 L"Files Missing", MB_ICONEXCLAMATION); | 1372 L"Files Missing", MB_ICONEXCLAMATION); |
1373 return false; | 1373 return false; |
1374 } | 1374 } |
1375 pIcons_LOD->dword_011BA4 = 0; | 1375 pIcons_LOD->_011BA4_debug_paletted_pixels_uncompressed = false; |
1376 | 1376 |
1377 pEvents_LOD = new LODFile_IconsBitmaps; | 1377 pEvents_LOD = new LODFile_IconsBitmaps; |
1378 if (!pEvents_LOD->Load("data\\events.lod", "icons")) | 1378 if (!pEvents_LOD->Load("data\\events.lod", "icons")) |
1379 { | 1379 { |
1380 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.", | 1380 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.", |
1743 int max_flight_height = 4000; //maximum altitude | 1743 int max_flight_height = 4000; //maximum altitude |
1744 bool use_MMT = false; | 1744 bool use_MMT = false; |
1745 bool use_music_folder = false; | 1745 bool use_music_folder = false; |
1746 bool for_refactoring = false; | 1746 bool for_refactoring = false; |
1747 bool all_spells = true; | 1747 bool all_spells = true; |
1748 bool bNoMargareth = false; | |
1749 | |
1750 void ParseCommandLine(const wchar_t *cmd) | |
1751 { | |
1752 //if (wcsstr(pCmdLine, L"-usedefs")) | |
1753 // bDebugResouces = 1; | |
1754 if (wcsstr(cmd, L"-window")) | |
1755 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW; | |
1756 | |
1757 if (wcsstr(cmd, L"-nointro")) | |
1758 bNoIntro = true;//dword_6BE364_game_settings_1 |= 4; | |
1759 if (wcsstr(cmd, L"-nologo")) | |
1760 bNoLogo = true;//dword_6BE364_game_settings_1 |= 8; | |
1761 if (wcsstr(cmd, L"-nosound")) | |
1762 bNoSound = true; //dword_6BE364_game_settings_1 |= 0x10; | |
1763 | |
1764 bWalkSound = ReadWindowsRegistryInt("WalkSound", 1) != 0; | |
1765 if (wcsstr(cmd, L"-nowalksound")) | |
1766 bWalkSound = false;//dword_6BE364_game_settings_1 |= 0x20; | |
1767 if (wcsstr(cmd, L"-novideo")) | |
1768 { | |
1769 dword_6BE364_game_settings_1 |= GAME_SETTINGS_NO_HOUSE_ANIM; | |
1770 bNoVideo = true; | |
1771 } | |
1772 if (wcsstr(cmd, L"-nocd")) | |
1773 bNoCD = true; | |
1774 if (wcsstr(cmd, L"-nomarg")) | |
1775 bNoMargareth = true; | |
1776 } | |
1748 | 1777 |
1749 //----- (00462C94) -------------------------------------------------------- | 1778 //----- (00462C94) -------------------------------------------------------- |
1750 bool MM_Main(const wchar_t *pCmdLine) | 1779 bool MM_Main(const wchar_t *pCmdLine) |
1751 { | 1780 { |
1752 IntegrityTest(); | 1781 IntegrityTest(); |
1753 | 1782 |
1754 lua = new LuaVM; | 1783 lua = new LuaVM; |
1755 lua->Initialize(); | 1784 lua->Initialize(); |
1756 | 1785 |
1757 bool bNoMargareth = false; | |
1758 if (pCmdLine && *pCmdLine) | 1786 if (pCmdLine && *pCmdLine) |
1759 { | 1787 ParseCommandLine(pCmdLine); |
1760 //if (wcsstr(pCmdLine, L"-usedefs")) | |
1761 // bDebugResouces = 1; | |
1762 if (wcsstr(pCmdLine, L"-window")) | |
1763 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW; | |
1764 | |
1765 if (wcsstr(pCmdLine, L"-nointro")) | |
1766 bNoIntro = true;//dword_6BE364_game_settings_1 |= 4; | |
1767 if (wcsstr(pCmdLine, L"-nologo")) | |
1768 bNoLogo = true;//dword_6BE364_game_settings_1 |= 8; | |
1769 if (wcsstr(pCmdLine, L"-nosound")) | |
1770 bNoSound = true; //dword_6BE364_game_settings_1 |= 0x10; | |
1771 | |
1772 bWalkSound = ReadWindowsRegistryInt("WalkSound", 1) != 0; | |
1773 if (wcsstr(pCmdLine, L"-nowalksound")) | |
1774 bWalkSound = false;//dword_6BE364_game_settings_1 |= 0x20; | |
1775 if (wcsstr(pCmdLine, L"-novideo")) | |
1776 { | |
1777 dword_6BE364_game_settings_1 |= GAME_SETTINGS_NO_HOUSE_ANIM; | |
1778 bNoVideo = true; | |
1779 } | |
1780 if (wcsstr(pCmdLine, L"-nocd")) | |
1781 bNoCD = true; | |
1782 if (wcsstr(pCmdLine, L"-nomarg")) | |
1783 bNoMargareth = true; | |
1784 } | |
1785 | |
1786 //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF );//Ritor1: for memory test | |
1787 | 1788 |
1788 if (!MM7_Initialize(640, 480)) | 1789 if (!MM7_Initialize(640, 480)) |
1789 { | 1790 { |
1790 Log::Warning(L"MM init: failed"); | 1791 Log::Warning(L"MM init: failed"); |
1791 pEngine->Deinitialize(); | 1792 pEngine->Deinitialize(); |
1792 return 1; | 1793 return 1; |
1793 } | 1794 } |
1794 | 1795 |
1795 pEventTimer->Pause(); | 1796 pEventTimer->Pause(); |
1796 | 1797 |
1797 SetUserInterface(PartyAlignment_Neutral, false); | 1798 GUIWindow::InitializeGUI(); |
1798 | 1799 |
1799 for (uint i = 0; i < 20; ++i) | |
1800 pWindowList[i] = nullptr; | |
1801 uNumVisibleWindows = -1; | |
1802 memset(pVisibleWindowsIdxs.data(), 0, sizeof(pVisibleWindowsIdxs)); | |
1803 | 1800 |
1804 ShowLogoVideo(); | 1801 ShowLogoVideo(); |
1805 //ShowIntroVideo_and_LoadingScreen(); | 1802 //ShowIntroVideo_and_LoadingScreen(); |
1806 WriteWindowsRegistryInt("Ran once", 1); | 1803 |
1807 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000; | 1804 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000; |
1808 | 1805 |
1809 //Ritor1: include | 1806 //if (use_MMT) |
1810 if (use_MMT) | 1807 // MMT_MainMenu_Loop(); |
1811 MMT_MainMenu_Loop(); | |
1812 | 1808 |
1813 Log::Warning(L"MM: entering main loop"); | 1809 Log::Warning(L"MM: entering main loop"); |
1814 while (1) | 1810 while (1) |
1815 { | 1811 { |
1816 //MainMenuWindow *main_menu_window = MainMenuWindow::Create(); | 1812 //MainMenuWindow *main_menu_window = MainMenuWindow::Create(); |
1837 else if (GetCurrentMenuID() == MENU_NEWGAME) | 1833 else if (GetCurrentMenuID() == MENU_NEWGAME) |
1838 { | 1834 { |
1839 pOtherOverlayList->Reset(); | 1835 pOtherOverlayList->Reset(); |
1840 if (!CreateParty_Loop()) | 1836 if (!CreateParty_Loop()) |
1841 break; | 1837 break; |
1838 | |
1839 | |
1840 pParty->pPickedItem.uItemID = 0; | |
1842 | 1841 |
1843 strcpy(pCurrentMapName, pStartingMapName); | 1842 strcpy(pCurrentMapName, pStartingMapName); |
1844 bFlashQuestBook = true; | 1843 bFlashQuestBook = true; |
1845 pMediaPlayer->PlayFullscreenMovie(MOVIE_Emerald, true); | 1844 pMediaPlayer->PlayFullscreenMovie(MOVIE_Emerald, true); |
1846 SaveNewGame(); | 1845 SaveNewGame(); |
1910 if (uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU)// from the loaded game | 1909 if (uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU)// from the loaded game |
1911 { | 1910 { |
1912 pAudioPlayer->StopChannels(-1, -1); | 1911 pAudioPlayer->StopChannels(-1, -1); |
1913 uGameState = GAME_STATE_PLAYING; | 1912 uGameState = GAME_STATE_PLAYING; |
1914 break; | 1913 break; |
1915 } | |
1916 } | |
1917 if (!bNoSound) | |
1918 { | |
1919 if (use_music_folder) | |
1920 { | |
1921 PlayAudio(L"Music\\14.mp3"); | |
1922 alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); | |
1923 } | |
1924 else if (pAudioPlayer->hAILRedbook) | |
1925 { | |
1926 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
1927 AIL_redbook_stop(pAudioPlayer->hAILRedbook); | |
1928 unsigned int startms, end_ms; | |
1929 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &startms, &end_ms); | |
1930 AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms); | |
1931 } | 1914 } |
1932 } | 1915 } |
1933 } | 1916 } |
1934 //lua_close(L); | 1917 //lua_close(L); |
1935 pEngine->Deinitialize(); | 1918 pEngine->Deinitialize(); |