# HG changeset patch # User Nomad # Date 1378551066 -7200 # Node ID 86cb7398d2a85de370de0a900bb40538c894242a # Parent 251111bac49fb675147616db51b2ecd7d9692016 mm8 icons diff -r 251111bac49f -r 86cb7398d2a8 LOD.cpp --- a/LOD.cpp Wed Aug 28 18:43:31 2013 +0200 +++ b/LOD.cpp Sat Sep 07 12:51:06 2013 +0200 @@ -21,12 +21,15 @@ LODFile_IconsBitmaps *pIcons_LOD = nullptr; LODFile_IconsBitmaps *pIcons_LOD_mm6 = nullptr; +LODFile_IconsBitmaps *pIcons_LOD_mm8 = nullptr; LODFile_IconsBitmaps *pBitmaps_LOD = nullptr; LODFile_IconsBitmaps *pBitmaps_LOD_mm6 = nullptr; +LODFile_IconsBitmaps *pBitmaps_LOD_mm8 = nullptr; LODFile_Sprites *pSprites_LOD = nullptr; LODFile_Sprites *pSprites_LOD_mm6 = nullptr; +LODFile_Sprites *pSprites_LOD_mm8 = nullptr; LODWriteableFile *pNew_LOD = nullptr; LODWriteableFile *pGames_LOD = nullptr; diff -r 251111bac49f -r 86cb7398d2a8 LOD.h --- a/LOD.h Wed Aug 28 18:43:31 2013 +0200 +++ b/LOD.h Sat Sep 07 12:51:06 2013 +0200 @@ -302,14 +302,18 @@ extern LODFile_IconsBitmaps *pEvents_LOD; + extern LODFile_IconsBitmaps *pIcons_LOD; extern LODFile_IconsBitmaps *pIcons_LOD_mm6; +extern LODFile_IconsBitmaps *pIcons_LOD_mm8; extern LODFile_IconsBitmaps *pBitmaps_LOD; extern LODFile_IconsBitmaps *pBitmaps_LOD_mm6; +extern LODFile_IconsBitmaps *pBitmaps_LOD_mm8; extern LODFile_Sprites *pSprites_LOD; extern LODFile_Sprites *pSprites_LOD_mm6; +extern LODFile_Sprites *pSprites_LOD_mm8; extern LODWriteableFile *pNew_LOD; extern LODWriteableFile *pGames_LOD; diff -r 251111bac49f -r 86cb7398d2a8 Render.cpp --- a/Render.cpp Wed Aug 28 18:43:31 2013 +0200 +++ b/Render.cpp Sat Sep 07 12:51:06 2013 +0200 @@ -8418,7 +8418,6 @@ ClipCursor(0); pRenderer->SwitchToWindow(hWnd); SetWindowLongA(hWnd, -16, uWindowStyle); - SetMenu(hWnd, hOSMenu); } if ( pRenderer->pRenderD3D ) { diff -r 251111bac49f -r 86cb7398d2a8 Sprites.cpp --- a/Sprites.cpp Wed Aug 28 18:43:31 2013 +0200 +++ b/Sprites.cpp Sat Sep 07 12:51:06 2013 +0200 @@ -405,8 +405,7 @@ pSpriteSFrames[num_mm7_frames + i].uAnimLength = 0; } memcpy(pSpriteEFrames + num_mm7_frames, (char *)data_mm6 + 8 + mm6_frames_size, 2 * num_mm6_eframes); - - if (data_mm8) __debugbreak(); + auto mm8_frames_size = num_mm8_frames * sizeof(SpriteFrame); memcpy(pSpriteSFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 8, mm8_frames_size); memcpy(pSpriteEFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 8 + mm8_frames_size, 2 * num_mm8_eframes); diff -r 251111bac49f -r 86cb7398d2a8 mm7_2.cpp --- a/mm7_2.cpp Wed Aug 28 18:43:31 2013 +0200 +++ b/mm7_2.cpp Sat Sep 07 12:51:06 2013 +0200 @@ -3426,6 +3426,7 @@ switch (Msg) { case WM_SIZING: return 1; + case WM_CREATE: case WM_NCCREATE: case WM_SHOWWINDOW: case WM_GETTEXT: case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam); @@ -4131,12 +4132,12 @@ pSpriteObjects[i].uObjectDescID = 0; v5 = pMapStats->GetMapInfo(pCurrentMapName); - bUnderwater = 0; + bUnderwater = false; uLevelMapStatsID = v5; pGame->uFlags2 &= 0xFFFFFFF7u; if ( !_stricmp(pCurrentMapName, "out15.odm") ) { - bUnderwater = 1; + bUnderwater = true; pGame->uFlags2 |= 8u; } pParty->floor_face_pid = 0; @@ -4577,11 +4578,6 @@ auto hDesktopDC = GetDC(nullptr); uint uDesktopWidth = GetDeviceCaps(hDesktopDC, HORZRES); uint uDesktopHeight = GetDeviceCaps(hDesktopDC, VERTRES); - - if (GetDeviceCaps(hDesktopDC, BITSPIXEL) != 16 || - GetDeviceCaps(hDesktopDC, PLANES) != 1 ) - dword_6BE364_game_settings_1 |= 2; - ReleaseDC(nullptr, hDesktopDC); uint uTotalWinWidth = 2 * GetSystemMetrics(SM_CXFRAME) + 640; @@ -4603,10 +4599,9 @@ uWindowX, uWindowY, 640, 480, nullptr, - hOSMenu = nullptr, + nullptr, wcxw.hInstance, nullptr); - SetWindowTextW(hWnd, L"Might and Magic® VII"); HMENU menu = CreateMenu(); { @@ -4911,54 +4906,48 @@ Log::Warning(L"Unable to find mm6:sprites.lod"); - - if (bDebugResouces) - { - pSpriteFrameTable = new SpriteFrameTable; - if (!pSpriteFrameTable->FromFileTxt("data\\sft.txt")) - Abortf("Unable to open sft.txt"); - - pDecorationList = new DecorationList; - if (!pDecorationList->FromFileTxt("data\\declist.txt")) - Abortf("Unable to open declist.txt"); - - pObjectList = new ObjectList; - if (!pObjectList->FromFileTxt("data\\objlist.txt")) - Abortf("Unable to open objlist.txt"); - - pMonsterList = new MonsterList; - if (!pMonsterList->FromFileTxt("data\\monlist.txt")) - Abortf("Unable to open monlist.txt"); - - pIconsFrameTable = new IconFrameTable; - if (!pIconsFrameTable->FromFileTxt("data\\ift.txt")) - Abortf("Unable to open ift.txt"); - - pTextureFrameTable = new TextureFrameTable; - if (!pTextureFrameTable->FromFileTxt("data\\tft.def")) - Abortf("Unable to open tft.def"); - - pTileTable = new TileTable; - if (!pTileTable->FromFileTxt("data\\tile.def")) - Abortf("Unable to open tile.def"); - - pPlayerFrameTable = new PlayerFrameTable; - if (!pPlayerFrameTable->FromFileTxt("data\\pft.def")) - Abortf("Unable to open pft.def"); - - pChestList = new ChestList; - if (!pChestList->FromFileTxt("data\\chest.def")) - Abortf("Unable to open chest.def"); - - pOverlayList = new OverlayList; - if (!pOverlayList->FromFileTxt("data\\overlay.def")) - Abortf("Unable to open overlay.def"); - - pSoundList = new SoundList; - if (!pSoundList->FromFileTxt("data\\sounds.def")) - Abortf("Unable to open sounds.def"); + if (_access("../mm8/data/icons.lod", 0) == 0) + { + pIcons_LOD_mm8 = new LODFile_IconsBitmaps; + if (!pIcons_LOD_mm8->Load("../mm8/data/icons.lod", "icons")) + { + delete pIcons_LOD_mm8; + pIcons_LOD_mm8 = nullptr; + Log::Warning(L"Unable to load mm8:icons.lod"); + } } else + Log::Warning(L"Unable to find mm8:icons.lod"); + + + if (_access("../mm8/data/bitmaps.lod", 0) == 0) + { + pBitmaps_LOD_mm8 = new LODFile_IconsBitmaps; + if (!pBitmaps_LOD_mm8->Load("../mm8/data/bitmaps.lod", "bitmaps")) + { + delete pBitmaps_LOD_mm8; + pBitmaps_LOD_mm8 = nullptr; + Log::Warning(L"Unable to load mm8:bitmaps.lod"); + } + } + else + Log::Warning(L"Unable to find mm8:bitmaps.lod"); + + + if (_access("../mm8/data/sprites.lod", 0) == 0) + { + pSprites_LOD_mm8 = new LODFile_Sprites; + if (!pSprites_LOD_mm8->LoadSprites("../mm8/data/sprites.lod")) + { + delete pSprites_LOD_mm8; + pSprites_LOD_mm8 = nullptr; + Log::Warning(L"Unable to load mm8:sprites.lod"); + } + } + else + Log::Warning(L"Unable to find mm8:sprites.lod"); + + { void *sft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsft.bin", 1) : nullptr, *sft_mm8 = nullptr; @@ -5061,20 +5050,6 @@ } - if (bDebugResouces) - { - pSpriteFrameTable->ToFile(); - pDecorationList->ToFile(); - pObjectList->ToFile(); - pMonsterList->ToFile(); - pIconsFrameTable->ToFile(); - pTextureFrameTable->ToFile(); - pTileTable->ToFile(); - pPlayerFrameTable->ToFile(); - pChestList->ToFile(); - pOverlayList->ToFile(); - pSoundList->ToFile(); - } if (dword_6BE364_game_settings_1 & 2 || !(dword_6BE368_debug_settings_2 & 1))// @@ -5395,19 +5370,6 @@ //----- (00462C94) -------------------------------------------------------- bool MM_Main(const wchar_t *pCmdLine) { - HWND hPrevWnd; // eax@1 - HWND hPrevWnd_; // esi@1 - HWND v6; // eax@4 - int v8; // eax@15 - //bool v9; // edx@16 - //OtherOverlay *v10; // esi@44 - //signed int v11; // edi@44 - //unsigned int v12; // ecx@56 - HANDLE v13; // eax@68 - unsigned int startms; // [sp+8h] [bp-24h]@55 - RECT Rect; // [sp+Ch] [bp-20h]@15 - int a2[4]; // [sp+1Ch] [bp-10h]@15 - IntegrityTest(); char test[1024]; sprintfex(test, "^Pi[%s]: çíàõàð^R[ü;êà;]", "Çîëòàí"); @@ -5459,7 +5421,6 @@ pGame->Deinitialize(); return 1; } - Log::Warning(L"MM init: ok"); pEventTimer->Pause(); @@ -5469,7 +5430,7 @@ dword_6BE364_game_settings_1 |= 0x4000; pGame->InitializeGammaController(); SecondaryInitialization(); - pRenderer->SetRasterClipRect(0, 0, 639u, 479u); + pRenderer->SetRasterClipRect(0, 0, 639, 479); FinalInitialization(); Log::Warning(L"MM: entering main loop"); @@ -5581,7 +5542,7 @@ { pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); AIL_redbook_stop(pAudioPlayer->hAILRedbook); - unsigned int end_ms; + unsigned int startms, end_ms; AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xE, &startms, &end_ms); AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms); } diff -r 251111bac49f -r 86cb7398d2a8 mm7_3.cpp --- a/mm7_3.cpp Wed Aug 28 18:43:31 2013 +0200 +++ b/mm7_3.cpp Sat Sep 07 12:51:06 2013 +0200 @@ -6885,10 +6885,10 @@ char pContainerName[120]; // [sp+8h] [bp-98h]@1 sprintf(pContainerName, "%s.evt", pLevelName); - uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 0x2400u); + uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 9216); sprintf(pContainerName, "%s.str", pLevelName); - uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 0x2400u); + uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 9216); if (uLevelStrFileSize) LoadLevel_InitializeLevelStr(); } diff -r 251111bac49f -r 86cb7398d2a8 mm7_data.cpp --- a/mm7_data.cpp Wed Aug 28 18:43:31 2013 +0200 +++ b/mm7_data.cpp Sat Sep 07 12:51:06 2013 +0200 @@ -1212,7 +1212,6 @@ int uWindowX; // idb int uWindowY; // idb LONG uWindowStyle; // idb -HMENU hOSMenu; // idb int dword_6BE340; // weak char pCurrentMapName[32]; // idb unsigned int uLevelMapStatsID; diff -r 251111bac49f -r 86cb7398d2a8 mm7_data.h --- a/mm7_data.h Wed Aug 28 18:43:31 2013 +0200 +++ b/mm7_data.h Sat Sep 07 12:51:06 2013 +0200 @@ -858,7 +858,6 @@ extern int uWindowX; // idb extern int uWindowY; // idb extern LONG uWindowStyle; // idb -extern HMENU hOSMenu; // idb extern int dword_6BE340; // weak extern char pCurrentMapName[32]; // idb extern unsigned int uLevelMapStatsID;