- fixed Blood music and movie playback.

I have no idea why the movie code was completely disabled in NBlood, it all works fine...
This commit is contained in:
Christoph Oelckers 2019-12-25 01:10:13 +01:00
parent 5bd32cf769
commit efe4261932
3 changed files with 26 additions and 19 deletions

View file

@ -96,6 +96,8 @@ char DoUnFade(int nTicks)
return 1; return 1;
} }
void credPlaySmk(const char* _pzSMK, const char* _pzWAV, int nWav);
void credLogosDos(void) void credLogosDos(void)
{ {
char bShift = inputState.ShiftPressed(); char bShift = inputState.ShiftPressed();
@ -105,9 +107,12 @@ void credLogosDos(void)
if (bShift) if (bShift)
return; return;
{ {
//CSMKPlayer smkPlayer; if (fileSystem.FindFile("logo.smk"))
//if (smkPlayer.PlaySMKWithWAV("LOGO.SMK", 300) == 1) {
//{ credPlaySmk("logo.smk", "logo.wav", -1);
}
else
{
rotatesprite(160<<16, 100<<16, 65536, 0, 2050, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1); rotatesprite(160<<16, 100<<16, 65536, 0, 2050, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1);
sndStartSample("THUNDER2", 128, -1); sndStartSample("THUNDER2", 128, -1);
scrNextPage(); scrNextPage();
@ -115,9 +120,13 @@ void credLogosDos(void)
return; return;
if (!DoFade(0, 0, 0, 60)) if (!DoFade(0, 0, 0, 60))
return; return;
//} }
//if (smkPlayer.PlaySMKWithWAV("GTI.SMK", 301) == 1) if (fileSystem.FindFile("gti.smk"))
//{ {
credPlaySmk("gti.smk", "gt.wav", -1);
}
else
{
videoClearScreen(0); videoClearScreen(0);
rotatesprite(160<<16, 100<<16, 65536, 0, 2052, 0, 0, 0x0a, 0, 0, xdim-1, ydim-1); rotatesprite(160<<16, 100<<16, 65536, 0, 2052, 0, 0, 0x0a, 0, 0, xdim-1, ydim-1);
scrNextPage(); scrNextPage();
@ -125,7 +134,7 @@ void credLogosDos(void)
sndStartSample("THUNDER2", 128, -1); sndStartSample("THUNDER2", 128, -1);
if (!Wait(360)) if (!Wait(360))
return; return;
//} }
} }
sndPlaySpecialMusicOrNothing(MUS_INTRO); sndPlaySpecialMusicOrNothing(MUS_INTRO);
sndStartSample("THUNDER2", 128, -1); 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); rotatesprite(160<<16, 100<<16, 65536, 0, 2518, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1);
scrNextPage(); scrNextPage();
Wait(360); Wait(360);
Mus_Fade(4000); //Mus_Fade(4000);
} }
void credReset(void) void credReset(void)
@ -177,7 +186,6 @@ FileReader credKOpen4Load(char *&pzFile)
void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav) void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
{ {
return;
#if 0 #if 0
CSMKPlayer smkPlayer; CSMKPlayer smkPlayer;
if (dword_148E14 >= 0) if (dword_148E14 >= 0)
@ -215,7 +223,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
Smacker_GetFrameSize(hSMK, nWidth, nHeight); Smacker_GetFrameSize(hSMK, nWidth, nHeight);
uint8_t palette[768]; uint8_t palette[768];
tileDelete(kSMKTile); tileDelete(kSMKTile);
auto pFrame = TileFiles.tileCreate(kSMKTile, nWidth, nHeight); auto pFrame = TileFiles.tileCreate(kSMKTile, nHeight, nWidth);
if (!pFrame) if (!pFrame)
{ {
Smacker_Close(hSMK); Smacker_Close(hSMK);

View file

@ -88,7 +88,7 @@ void levelOverrideINI(const char *pzIni)
void levelPlayIntroScene(int nEpisode) void levelPlayIntroScene(int nEpisode)
{ {
gGameOptions.uGameFlags &= ~4; gGameOptions.uGameFlags &= ~4;
Mus_Stop(); Mus_SetPaused(true);
sndKillAllSounds(); sndKillAllSounds();
sfxKillAllSounds(); sfxKillAllSounds();
ambKillAll(); ambKillAll();
@ -99,6 +99,7 @@ void levelPlayIntroScene(int nEpisode)
viewResizeView(gViewSize); viewResizeView(gViewSize);
credReset(); credReset();
scrSetDac(); scrSetDac();
Mus_SetPaused(false);
} }
void levelPlayEndScene(int nEpisode) void levelPlayEndScene(int nEpisode)
@ -207,7 +208,7 @@ void levelLoadMapInfo(IniFile *pIni, MapRecord *pLevelInfo, const char *pzSectio
char buffer[16]; char buffer[16];
pLevelInfo->SetName(pIni->GetKeyString(pzSection, "Title", pLevelInfo->labelName)); pLevelInfo->SetName(pIni->GetKeyString(pzSection, "Title", pLevelInfo->labelName));
pLevelInfo->author = pIni->GetKeyString(pzSection, "Author", ""); 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->cdSongId = pIni->GetKeyInt(pzSection, "Track", -1);
pLevelInfo->nextLevel = pIni->GetKeyInt(pzSection, "EndingA", -1); //if (pLevelInfo->nextLevel >= 0) pLevelInfo->nextLevel +epinum * kMaxLevels; 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; 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) bool levelTryPlayMusic(int nEpisode, int nLevel, bool bSetLevelSong)
{ {
char buffer[BMAX_PATH]; FString buffer;
if (mus_redbook && gEpisodeInfo[nEpisode].levels[nLevel].cdSongId > 0) 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 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); return !!Mus_Play(gEpisodeInfo[nEpisode].levels[nLevel].labelName, buffer, true);
} }
void levelTryPlayMusicOrNothing(int nEpisode, int nLevel) void levelTryPlayMusicOrNothing(int nEpisode, int nLevel)
{ {
if (levelTryPlayMusic(nEpisode, nLevel, true)) if (!levelTryPlayMusic(nEpisode, nLevel, true))
Mus_Stop(); Mus_Stop();
} }

View file

@ -412,7 +412,6 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
return 0; return 0;
#if 0 // NOTE: Reactivate!!!
case WM_KILLFOCUS: case WM_KILLFOCUS:
I_CheckNativeMouse (true, false); // Make sure mouse gets released right away I_CheckNativeMouse (true, false); // Make sure mouse gets released right away
break; break;
@ -420,7 +419,6 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_SETFOCUS: case WM_SETFOCUS:
I_CheckNativeMouse (false, false); // This cannot call the event handler. Doing it from here is unsafe. I_CheckNativeMouse (false, false); // This cannot call the event handler. Doing it from here is unsafe.
break; break;
#endif
case WM_SETCURSOR: case WM_SETCURSOR:
if (!CursorState) if (!CursorState)