From efe4261932662c6f90c5bb131571e64633f98cfc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 25 Dec 2019 01:10:13 +0100 Subject: [PATCH] - fixed Blood music and movie playback. I have no idea why the movie code was completely disabled in NBlood, it all works fine... --- source/blood/src/credits.cpp | 28 ++++++++++++++++++---------- source/blood/src/levels.cpp | 15 ++++++++------- source/platform/win32/i_input.cpp | 2 -- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/source/blood/src/credits.cpp b/source/blood/src/credits.cpp index 0ff8586ca..9885d7079 100644 --- a/source/blood/src/credits.cpp +++ b/source/blood/src/credits.cpp @@ -96,6 +96,8 @@ char DoUnFade(int nTicks) return 1; } +void credPlaySmk(const char* _pzSMK, const char* _pzWAV, int nWav); + void credLogosDos(void) { char bShift = inputState.ShiftPressed(); @@ -105,9 +107,12 @@ void credLogosDos(void) if (bShift) return; { - //CSMKPlayer smkPlayer; - //if (smkPlayer.PlaySMKWithWAV("LOGO.SMK", 300) == 1) - //{ + if (fileSystem.FindFile("logo.smk")) + { + credPlaySmk("logo.smk", "logo.wav", -1); + } + else + { rotatesprite(160<<16, 100<<16, 65536, 0, 2050, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1); sndStartSample("THUNDER2", 128, -1); scrNextPage(); @@ -115,9 +120,13 @@ void credLogosDos(void) return; if (!DoFade(0, 0, 0, 60)) return; - //} - //if (smkPlayer.PlaySMKWithWAV("GTI.SMK", 301) == 1) - //{ + } + if (fileSystem.FindFile("gti.smk")) + { + credPlaySmk("gti.smk", "gt.wav", -1); + } + else + { videoClearScreen(0); rotatesprite(160<<16, 100<<16, 65536, 0, 2052, 0, 0, 0x0a, 0, 0, xdim-1, ydim-1); scrNextPage(); @@ -125,7 +134,7 @@ void credLogosDos(void) sndStartSample("THUNDER2", 128, -1); if (!Wait(360)) return; - //} + } } sndPlaySpecialMusicOrNothing(MUS_INTRO); sndStartSample("THUNDER2", 128, -1); @@ -139,7 +148,7 @@ void credLogosDos(void) rotatesprite(160<<16, 100<<16, 65536, 0, 2518, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1); scrNextPage(); Wait(360); - Mus_Fade(4000); + //Mus_Fade(4000); } void credReset(void) @@ -177,7 +186,6 @@ FileReader credKOpen4Load(char *&pzFile) void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav) { - return; #if 0 CSMKPlayer smkPlayer; if (dword_148E14 >= 0) @@ -215,7 +223,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav) Smacker_GetFrameSize(hSMK, nWidth, nHeight); uint8_t palette[768]; tileDelete(kSMKTile); - auto pFrame = TileFiles.tileCreate(kSMKTile, nWidth, nHeight); + auto pFrame = TileFiles.tileCreate(kSMKTile, nHeight, nWidth); if (!pFrame) { Smacker_Close(hSMK); diff --git a/source/blood/src/levels.cpp b/source/blood/src/levels.cpp index b778153b4..763ec5a79 100644 --- a/source/blood/src/levels.cpp +++ b/source/blood/src/levels.cpp @@ -88,7 +88,7 @@ void levelOverrideINI(const char *pzIni) void levelPlayIntroScene(int nEpisode) { gGameOptions.uGameFlags &= ~4; - Mus_Stop(); + Mus_SetPaused(true); sndKillAllSounds(); sfxKillAllSounds(); ambKillAll(); @@ -99,6 +99,7 @@ void levelPlayIntroScene(int nEpisode) viewResizeView(gViewSize); credReset(); scrSetDac(); + Mus_SetPaused(false); } void levelPlayEndScene(int nEpisode) @@ -207,7 +208,7 @@ void levelLoadMapInfo(IniFile *pIni, MapRecord *pLevelInfo, const char *pzSectio char buffer[16]; pLevelInfo->SetName(pIni->GetKeyString(pzSection, "Title", pLevelInfo->labelName)); pLevelInfo->author = pIni->GetKeyString(pzSection, "Author", ""); - pLevelInfo->music.Format("%s.%s", pIni->GetKeyString(pzSection, "Song", ""), ".mid"); + pLevelInfo->music = pIni->GetKeyString(pzSection, "Song", ""); DefaultExtension(pLevelInfo->music, ".mid"); pLevelInfo->cdSongId = pIni->GetKeyInt(pzSection, "Track", -1); pLevelInfo->nextLevel = pIni->GetKeyInt(pzSection, "EndingA", -1); //if (pLevelInfo->nextLevel >= 0) pLevelInfo->nextLevel +epinum * kMaxLevels; pLevelInfo->nextSecret = pIni->GetKeyInt(pzSection, "EndingB", -1); //if (pLevelInfo->nextSecret >= 0) pLevelInfo->nextSecret + epinum * kMaxLevels; @@ -398,20 +399,20 @@ int levelGetMusicIdx(const char *str) bool levelTryPlayMusic(int nEpisode, int nLevel, bool bSetLevelSong) { - char buffer[BMAX_PATH]; + FString buffer; if (mus_redbook && gEpisodeInfo[nEpisode].levels[nLevel].cdSongId > 0) - snprintf(buffer, BMAX_PATH, "blood%02i.ogg", gEpisodeInfo[nEpisode].levels[nLevel].cdSongId); + buffer.Format("blood%02i.ogg", gEpisodeInfo[nEpisode].levels[nLevel].cdSongId); else { - strncpy(buffer, gEpisodeInfo[nEpisode].levels[nLevel].music, BMAX_PATH); + buffer = gEpisodeInfo[nEpisode].levels[nLevel].music; + DefaultExtension(buffer, ".mid"); } - if (!strchr(buffer, '.')) strcat(buffer, ".mid"); return !!Mus_Play(gEpisodeInfo[nEpisode].levels[nLevel].labelName, buffer, true); } void levelTryPlayMusicOrNothing(int nEpisode, int nLevel) { - if (levelTryPlayMusic(nEpisode, nLevel, true)) + if (!levelTryPlayMusic(nEpisode, nLevel, true)) Mus_Stop(); } diff --git a/source/platform/win32/i_input.cpp b/source/platform/win32/i_input.cpp index 01ac32431..b0083b30d 100644 --- a/source/platform/win32/i_input.cpp +++ b/source/platform/win32/i_input.cpp @@ -412,7 +412,6 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } return 0; -#if 0 // NOTE: Reactivate!!! case WM_KILLFOCUS: I_CheckNativeMouse (true, false); // Make sure mouse gets released right away break; @@ -420,7 +419,6 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_SETFOCUS: I_CheckNativeMouse (false, false); // This cannot call the event handler. Doing it from here is unsafe. break; -#endif case WM_SETCURSOR: if (!CursorState)