Mercurial > mm7
comparison mm7_2.cpp @ 1541:86cb7398d2a8
mm8 icons
author | Nomad |
---|---|
date | Sat, 07 Sep 2013 12:51:06 +0200 |
parents | 7ef4b64f6329 |
children | 7d986a396092 |
comparison
equal
deleted
inserted
replaced
1478:251111bac49f | 1541:86cb7398d2a8 |
---|---|
3424 int a2; // [sp+7Ch] [bp+10h]@50 | 3424 int a2; // [sp+7Ch] [bp+10h]@50 |
3425 | 3425 |
3426 switch (Msg) | 3426 switch (Msg) |
3427 { | 3427 { |
3428 case WM_SIZING: return 1; | 3428 case WM_SIZING: return 1; |
3429 case WM_CREATE: case WM_NCCREATE: | |
3429 case WM_SHOWWINDOW: | 3430 case WM_SHOWWINDOW: |
3430 case WM_GETTEXT: | 3431 case WM_GETTEXT: |
3431 case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam); | 3432 case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam); |
3432 | 3433 |
3433 case WM_WINDOWPOSCHANGED: | 3434 case WM_WINDOWPOSCHANGED: |
4129 | 4130 |
4130 for (uint i = 0; i < 1000; ++i) | 4131 for (uint i = 0; i < 1000; ++i) |
4131 pSpriteObjects[i].uObjectDescID = 0; | 4132 pSpriteObjects[i].uObjectDescID = 0; |
4132 | 4133 |
4133 v5 = pMapStats->GetMapInfo(pCurrentMapName); | 4134 v5 = pMapStats->GetMapInfo(pCurrentMapName); |
4134 bUnderwater = 0; | 4135 bUnderwater = false; |
4135 uLevelMapStatsID = v5; | 4136 uLevelMapStatsID = v5; |
4136 pGame->uFlags2 &= 0xFFFFFFF7u; | 4137 pGame->uFlags2 &= 0xFFFFFFF7u; |
4137 if ( !_stricmp(pCurrentMapName, "out15.odm") ) | 4138 if ( !_stricmp(pCurrentMapName, "out15.odm") ) |
4138 { | 4139 { |
4139 bUnderwater = 1; | 4140 bUnderwater = true; |
4140 pGame->uFlags2 |= 8u; | 4141 pGame->uFlags2 |= 8u; |
4141 } | 4142 } |
4142 pParty->floor_face_pid = 0; | 4143 pParty->floor_face_pid = 0; |
4143 if ( _stricmp(Str1, "blv") ) | 4144 if ( _stricmp(Str1, "blv") ) |
4144 PrepareToLoadODM(v9, 0); | 4145 PrepareToLoadODM(v9, 0); |
4575 } | 4576 } |
4576 | 4577 |
4577 auto hDesktopDC = GetDC(nullptr); | 4578 auto hDesktopDC = GetDC(nullptr); |
4578 uint uDesktopWidth = GetDeviceCaps(hDesktopDC, HORZRES); | 4579 uint uDesktopWidth = GetDeviceCaps(hDesktopDC, HORZRES); |
4579 uint uDesktopHeight = GetDeviceCaps(hDesktopDC, VERTRES); | 4580 uint uDesktopHeight = GetDeviceCaps(hDesktopDC, VERTRES); |
4580 | |
4581 if (GetDeviceCaps(hDesktopDC, BITSPIXEL) != 16 || | |
4582 GetDeviceCaps(hDesktopDC, PLANES) != 1 ) | |
4583 dword_6BE364_game_settings_1 |= 2; | |
4584 | |
4585 ReleaseDC(nullptr, hDesktopDC); | 4581 ReleaseDC(nullptr, hDesktopDC); |
4586 | 4582 |
4587 uint uTotalWinWidth = 2 * GetSystemMetrics(SM_CXFRAME) + 640; | 4583 uint uTotalWinWidth = 2 * GetSystemMetrics(SM_CXFRAME) + 640; |
4588 uint uTotalWinHeight = GetSystemMetrics(SM_CYCAPTION) + 2 * GetSystemMetrics(SM_CYFRAME) + 480; | 4584 uint uTotalWinHeight = GetSystemMetrics(SM_CYCAPTION) + 2 * GetSystemMetrics(SM_CYFRAME) + 480; |
4589 | 4585 |
4601 hWnd = CreateWindowExW(0, wcxw.lpszClassName, L"Might and Magic® VII", | 4597 hWnd = CreateWindowExW(0, wcxw.lpszClassName, L"Might and Magic® VII", |
4602 uWindowStyle = WS_SYSMENU | WS_GROUP | WS_DLGFRAME | WS_BORDER, | 4598 uWindowStyle = WS_SYSMENU | WS_GROUP | WS_DLGFRAME | WS_BORDER, |
4603 uWindowX, uWindowY, | 4599 uWindowX, uWindowY, |
4604 640, 480, | 4600 640, 480, |
4605 nullptr, | 4601 nullptr, |
4606 hOSMenu = nullptr, | 4602 nullptr, |
4607 wcxw.hInstance, | 4603 wcxw.hInstance, |
4608 nullptr); | 4604 nullptr); |
4609 SetWindowTextW(hWnd, L"Might and Magic® VII"); | |
4610 | 4605 |
4611 HMENU menu = CreateMenu(); | 4606 HMENU menu = CreateMenu(); |
4612 { | 4607 { |
4613 HMENU file = CreatePopupMenu(); | 4608 HMENU file = CreatePopupMenu(); |
4614 AppendMenuW(menu, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)file, L"&File"); | 4609 AppendMenuW(menu, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)file, L"&File"); |
4909 } | 4904 } |
4910 else | 4905 else |
4911 Log::Warning(L"Unable to find mm6:sprites.lod"); | 4906 Log::Warning(L"Unable to find mm6:sprites.lod"); |
4912 | 4907 |
4913 | 4908 |
4914 | 4909 if (_access("../mm8/data/icons.lod", 0) == 0) |
4915 if (bDebugResouces) | 4910 { |
4916 { | 4911 pIcons_LOD_mm8 = new LODFile_IconsBitmaps; |
4917 pSpriteFrameTable = new SpriteFrameTable; | 4912 if (!pIcons_LOD_mm8->Load("../mm8/data/icons.lod", "icons")) |
4918 if (!pSpriteFrameTable->FromFileTxt("data\\sft.txt")) | 4913 { |
4919 Abortf("Unable to open sft.txt"); | 4914 delete pIcons_LOD_mm8; |
4920 | 4915 pIcons_LOD_mm8 = nullptr; |
4921 pDecorationList = new DecorationList; | 4916 Log::Warning(L"Unable to load mm8:icons.lod"); |
4922 if (!pDecorationList->FromFileTxt("data\\declist.txt")) | 4917 } |
4923 Abortf("Unable to open declist.txt"); | |
4924 | |
4925 pObjectList = new ObjectList; | |
4926 if (!pObjectList->FromFileTxt("data\\objlist.txt")) | |
4927 Abortf("Unable to open objlist.txt"); | |
4928 | |
4929 pMonsterList = new MonsterList; | |
4930 if (!pMonsterList->FromFileTxt("data\\monlist.txt")) | |
4931 Abortf("Unable to open monlist.txt"); | |
4932 | |
4933 pIconsFrameTable = new IconFrameTable; | |
4934 if (!pIconsFrameTable->FromFileTxt("data\\ift.txt")) | |
4935 Abortf("Unable to open ift.txt"); | |
4936 | |
4937 pTextureFrameTable = new TextureFrameTable; | |
4938 if (!pTextureFrameTable->FromFileTxt("data\\tft.def")) | |
4939 Abortf("Unable to open tft.def"); | |
4940 | |
4941 pTileTable = new TileTable; | |
4942 if (!pTileTable->FromFileTxt("data\\tile.def")) | |
4943 Abortf("Unable to open tile.def"); | |
4944 | |
4945 pPlayerFrameTable = new PlayerFrameTable; | |
4946 if (!pPlayerFrameTable->FromFileTxt("data\\pft.def")) | |
4947 Abortf("Unable to open pft.def"); | |
4948 | |
4949 pChestList = new ChestList; | |
4950 if (!pChestList->FromFileTxt("data\\chest.def")) | |
4951 Abortf("Unable to open chest.def"); | |
4952 | |
4953 pOverlayList = new OverlayList; | |
4954 if (!pOverlayList->FromFileTxt("data\\overlay.def")) | |
4955 Abortf("Unable to open overlay.def"); | |
4956 | |
4957 pSoundList = new SoundList; | |
4958 if (!pSoundList->FromFileTxt("data\\sounds.def")) | |
4959 Abortf("Unable to open sounds.def"); | |
4960 } | 4918 } |
4961 else | 4919 else |
4920 Log::Warning(L"Unable to find mm8:icons.lod"); | |
4921 | |
4922 | |
4923 if (_access("../mm8/data/bitmaps.lod", 0) == 0) | |
4924 { | |
4925 pBitmaps_LOD_mm8 = new LODFile_IconsBitmaps; | |
4926 if (!pBitmaps_LOD_mm8->Load("../mm8/data/bitmaps.lod", "bitmaps")) | |
4927 { | |
4928 delete pBitmaps_LOD_mm8; | |
4929 pBitmaps_LOD_mm8 = nullptr; | |
4930 Log::Warning(L"Unable to load mm8:bitmaps.lod"); | |
4931 } | |
4932 } | |
4933 else | |
4934 Log::Warning(L"Unable to find mm8:bitmaps.lod"); | |
4935 | |
4936 | |
4937 if (_access("../mm8/data/sprites.lod", 0) == 0) | |
4938 { | |
4939 pSprites_LOD_mm8 = new LODFile_Sprites; | |
4940 if (!pSprites_LOD_mm8->LoadSprites("../mm8/data/sprites.lod")) | |
4941 { | |
4942 delete pSprites_LOD_mm8; | |
4943 pSprites_LOD_mm8 = nullptr; | |
4944 Log::Warning(L"Unable to load mm8:sprites.lod"); | |
4945 } | |
4946 } | |
4947 else | |
4948 Log::Warning(L"Unable to find mm8:sprites.lod"); | |
4949 | |
4950 | |
4962 { | 4951 { |
4963 void *sft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsft.bin", 1) : nullptr, | 4952 void *sft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsft.bin", 1) : nullptr, |
4964 *sft_mm8 = nullptr; | 4953 *sft_mm8 = nullptr; |
4965 auto sft_mm7 = pEvents_LOD->LoadRaw("dsft.bin", 1); | 4954 auto sft_mm7 = pEvents_LOD->LoadRaw("dsft.bin", 1); |
4966 pSpriteFrameTable = new SpriteFrameTable; | 4955 pSpriteFrameTable = new SpriteFrameTable; |
5059 free(sounds_mm7); | 5048 free(sounds_mm7); |
5060 free(sounds_mm8); | 5049 free(sounds_mm8); |
5061 } | 5050 } |
5062 | 5051 |
5063 | 5052 |
5064 if (bDebugResouces) | |
5065 { | |
5066 pSpriteFrameTable->ToFile(); | |
5067 pDecorationList->ToFile(); | |
5068 pObjectList->ToFile(); | |
5069 pMonsterList->ToFile(); | |
5070 pIconsFrameTable->ToFile(); | |
5071 pTextureFrameTable->ToFile(); | |
5072 pTileTable->ToFile(); | |
5073 pPlayerFrameTable->ToFile(); | |
5074 pChestList->ToFile(); | |
5075 pOverlayList->ToFile(); | |
5076 pSoundList->ToFile(); | |
5077 } | |
5078 | 5053 |
5079 | 5054 |
5080 if (dword_6BE364_game_settings_1 & 2 || !(dword_6BE368_debug_settings_2 & 1))// | 5055 if (dword_6BE364_game_settings_1 & 2 || !(dword_6BE368_debug_settings_2 & 1))// |
5081 // color depth != 16 | 5056 // color depth != 16 |
5082 // or | 5057 // or |
5393 bool all_magic = true; | 5368 bool all_magic = true; |
5394 | 5369 |
5395 //----- (00462C94) -------------------------------------------------------- | 5370 //----- (00462C94) -------------------------------------------------------- |
5396 bool MM_Main(const wchar_t *pCmdLine) | 5371 bool MM_Main(const wchar_t *pCmdLine) |
5397 { | 5372 { |
5398 HWND hPrevWnd; // eax@1 | |
5399 HWND hPrevWnd_; // esi@1 | |
5400 HWND v6; // eax@4 | |
5401 int v8; // eax@15 | |
5402 //bool v9; // edx@16 | |
5403 //OtherOverlay *v10; // esi@44 | |
5404 //signed int v11; // edi@44 | |
5405 //unsigned int v12; // ecx@56 | |
5406 HANDLE v13; // eax@68 | |
5407 unsigned int startms; // [sp+8h] [bp-24h]@55 | |
5408 RECT Rect; // [sp+Ch] [bp-20h]@15 | |
5409 int a2[4]; // [sp+1Ch] [bp-10h]@15 | |
5410 | |
5411 IntegrityTest(); | 5373 IntegrityTest(); |
5412 char test[1024]; | 5374 char test[1024]; |
5413 sprintfex(test, "^Pi[%s]: çíàõàð^R[ü;êà;]", "Çîëòàí"); | 5375 sprintfex(test, "^Pi[%s]: çíàõàð^R[ü;êà;]", "Çîëòàí"); |
5414 | 5376 |
5415 bool bNoMargareth = false; | 5377 bool bNoMargareth = false; |
5457 { | 5419 { |
5458 Log::Warning(L"MM init: failed"); | 5420 Log::Warning(L"MM init: failed"); |
5459 pGame->Deinitialize(); | 5421 pGame->Deinitialize(); |
5460 return 1; | 5422 return 1; |
5461 } | 5423 } |
5462 Log::Warning(L"MM init: ok"); | |
5463 | 5424 |
5464 pEventTimer->Pause(); | 5425 pEventTimer->Pause(); |
5465 | 5426 |
5466 SetUserInterface(PartyAlignment_Neutral, false); | 5427 SetUserInterface(PartyAlignment_Neutral, false); |
5467 ShowIntroVideo_and_LoadingScreen(); | 5428 ShowIntroVideo_and_LoadingScreen(); |
5468 WriteWindowsRegistryInt("Ran once", 1); | 5429 WriteWindowsRegistryInt("Ran once", 1); |
5469 dword_6BE364_game_settings_1 |= 0x4000; | 5430 dword_6BE364_game_settings_1 |= 0x4000; |
5470 pGame->InitializeGammaController(); | 5431 pGame->InitializeGammaController(); |
5471 SecondaryInitialization(); | 5432 SecondaryInitialization(); |
5472 pRenderer->SetRasterClipRect(0, 0, 639u, 479u); | 5433 pRenderer->SetRasterClipRect(0, 0, 639, 479); |
5473 FinalInitialization(); | 5434 FinalInitialization(); |
5474 | 5435 |
5475 Log::Warning(L"MM: entering main loop"); | 5436 Log::Warning(L"MM: entering main loop"); |
5476 while ( 1 ) | 5437 while ( 1 ) |
5477 { | 5438 { |
5579 } | 5540 } |
5580 if (!bNoSound && pAudioPlayer->hAILRedbook) | 5541 if (!bNoSound && pAudioPlayer->hAILRedbook) |
5581 { | 5542 { |
5582 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | 5543 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); |
5583 AIL_redbook_stop(pAudioPlayer->hAILRedbook); | 5544 AIL_redbook_stop(pAudioPlayer->hAILRedbook); |
5584 unsigned int end_ms; | 5545 unsigned int startms, end_ms; |
5585 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xE, &startms, &end_ms); | 5546 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xE, &startms, &end_ms); |
5586 AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms); | 5547 AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms); |
5587 } | 5548 } |
5588 } | 5549 } |
5589 | 5550 |