From e0ee3a67017e0ca3e19203fc32fb26418c17c84f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 8 Apr 2021 09:29:08 +0200 Subject: [PATCH 1/7] - fixed: Vulkan did not define NPOT_EMULATION for its fragment shader. --- source/common/rendering/vulkan/shaders/vk_shader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/common/rendering/vulkan/shaders/vk_shader.cpp b/source/common/rendering/vulkan/shaders/vk_shader.cpp index acb15dd47..84f7d3d5e 100644 --- a/source/common/rendering/vulkan/shaders/vk_shader.cpp +++ b/source/common/rendering/vulkan/shaders/vk_shader.cpp @@ -296,6 +296,9 @@ std::unique_ptr VkShaderManager::LoadFragShader(FString shadername code << defines; code << "\n$placeholder$"; // here the code can later add more needed #defines. code << "\n#define MAX_STREAM_DATA " << std::to_string(MAX_STREAM_DATA).c_str() << "\n"; +#ifdef NPOT_EMULATION + code << "#define NPOT_EMULATION\n"; +#endif code << shaderBindings; FString placeholder = "\n"; From 1439897b65f9083f9d76954842561d7770555aeb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 8 Apr 2021 15:55:37 +0200 Subject: [PATCH 2/7] - fixed extended music lookup. The logic was inverted for extended lookup which always resulted in failure to find the song. --- source/core/raze_music.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/raze_music.cpp b/source/core/raze_music.cpp index 9ee2d1c72..69cc5dbba 100644 --- a/source/core/raze_music.cpp +++ b/source/core/raze_music.cpp @@ -132,7 +132,7 @@ FileReader OpenMusic(const char* musicname) if (!reader.isOpen()) { int lumpnum = LookupMusic(musicname); - if (mus_extendedlookup && lumpnum >= 0) + if (mus_extendedlookup && lumpnum < 0) { // EDuke also looks in a subfolder named after the main game resource. Do this as well if extended lookup is active. auto rfn = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(lumpnum)); From e2f570a70afcf6e8cff983ca0e94aa2fba0630d5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 8 Apr 2021 16:05:32 +0200 Subject: [PATCH 3/7] - fixed: extended sound lookup must check the sound/ folder. --- source/core/raze_sound.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/core/raze_sound.cpp b/source/core/raze_sound.cpp index 4020f1b0a..463fece92 100644 --- a/source/core/raze_sound.cpp +++ b/source/core/raze_sound.cpp @@ -142,7 +142,11 @@ int S_LookupSound(const char* fn) static const char * const sndformats[] = { "OGG", "FLAC", "WAV" }; if (snd_extendedlookup) { - int lump = fileSystem.FindFileWithExtensions(StripExtension(fn), sndformats, countof(sndformats)); + auto newfn = StripExtension(fn); + int lump = fileSystem.FindFileWithExtensions(newfn, sndformats, countof(sndformats)); + if (lump >= 0) return lump; + newfn = "sound/" + newfn; + lump = fileSystem.FindFileWithExtensions(newfn, sndformats, countof(sndformats)); if (lump >= 0) return lump; } return fileSystem.FindFile(fn); From fc1fbfe8b351884e5ca5ef2b04d9b23869793c56 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 8 Apr 2021 16:35:26 +0200 Subject: [PATCH 4/7] - fixed .def 'music' parsing. This was incomplete and just ignored Duke's special music, and the levelnum generation used an outdated formula so that it never managed to assign any music to the maps. --- source/core/mapinfo.cpp | 6 ++++-- source/core/raze_music.cpp | 1 + source/core/raze_music.h | 1 + source/games/duke/src/sounds.cpp | 1 - source/games/duke/src/sounds.h | 2 -- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/core/mapinfo.cpp b/source/core/mapinfo.cpp index 506cae54c..609081f7f 100644 --- a/source/core/mapinfo.cpp +++ b/source/core/mapinfo.cpp @@ -38,6 +38,7 @@ #include "raze_music.h" #include "filesystem.h" #include "printf.h" +#include "raze_sound.h" FString gSkillNames[MAXSKILLS]; FString gVolumeNames[MAXVOLUMES]; @@ -109,7 +110,8 @@ bool SetMusicForMap(const char* mapname, const char* music, bool namehack) { if (!stricmp(mapname, specials[i])) { - // todo: store this properly. + if (specialmusic.Size() <= i) specialmusic.Resize(i + 1); + specialmusic[i] = music; return true; } } @@ -127,7 +129,7 @@ bool SetMusicForMap(const char* mapname, const char* music, bool namehack) if (numMatches != 4 || toupper(b1) != 'E' || toupper(b2) != 'L') return false; - index = FindMapByLevelNum(ep*100 + lev); + index = FindMapByLevelNum(levelnum(ep - 1, lev - 1)); } if (index != nullptr) diff --git a/source/core/raze_music.cpp b/source/core/raze_music.cpp index 69cc5dbba..8586dbc00 100644 --- a/source/core/raze_music.cpp +++ b/source/core/raze_music.cpp @@ -46,6 +46,7 @@ static bool mus_blocked; static FString lastStartedMusic; +TArray specialmusic; MusicAliasMap MusicAliases; MusicAliasMap LevelMusicAliases; diff --git a/source/core/raze_music.h b/source/core/raze_music.h index a9051d650..a87644406 100644 --- a/source/core/raze_music.h +++ b/source/core/raze_music.h @@ -6,6 +6,7 @@ typedef TMap MusicAliasMap; extern MusicAliasMap MusicAliases; +extern TArray specialmusic; // Totally minimalistic interface - should be all the game modules need. void Mus_InitMusic(); diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 79970b348..aefc53400 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -65,7 +65,6 @@ inline DDukeActor* getSndActor(const void* source) return source ? &hittype[((spritetype*)source) - sprite] : nullptr; } -TArray specialmusic; static FSoundID currentCommentarySound; static DDukeActor* currentCommentarySprite; // todo: GC this once actors become objects diff --git a/source/games/duke/src/sounds.h b/source/games/duke/src/sounds.h index 883496606..415af4406 100644 --- a/source/games/duke/src/sounds.h +++ b/source/games/duke/src/sounds.h @@ -74,8 +74,6 @@ void S_ParseDeveloperCommentary(); void StopCommentary(); bool StartCommentary(int tag, DDukeActor* sprnum); -extern TArray specialmusic; - END_DUKE_NS From a53ed46baeac0b5f556c44be65a6ec9af11f65b2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 8 Apr 2021 17:43:56 +0200 Subject: [PATCH 5/7] - fixed item placement on SW minihud. Fixes #295 --- source/games/sw/src/sbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/games/sw/src/sbar.cpp b/source/games/sw/src/sbar.cpp index c9cd50ba8..51a380646 100644 --- a/source/games/sw/src/sbar.cpp +++ b/source/games/sw/src/sbar.cpp @@ -695,7 +695,7 @@ private: void DisplayMinibarInventory(PLAYERp pp) { int InventoryBoxX = MINI_BAR_INVENTORY_BOX_X; - int InventoryBoxY = MINI_BAR_INVENTORY_BOX_Y; + int InventoryBoxY = MINI_BAR_INVENTORY_BOX_Y - 200; int InventoryXoff = 0; int InventoryYoff = 1; From 793d2d99ef14329fe5313b4d8ccd22310cfe952b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 8 Apr 2021 17:46:53 +0200 Subject: [PATCH 6/7] - re-fixed the music lookup. --- source/core/raze_music.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/core/raze_music.cpp b/source/core/raze_music.cpp index 8586dbc00..b2c3f0aed 100644 --- a/source/core/raze_music.cpp +++ b/source/core/raze_music.cpp @@ -133,13 +133,14 @@ FileReader OpenMusic(const char* musicname) if (!reader.isOpen()) { int lumpnum = LookupMusic(musicname); - if (mus_extendedlookup && lumpnum < 0) + if (mus_extendedlookup && lumpnum >= 0) { // EDuke also looks in a subfolder named after the main game resource. Do this as well if extended lookup is active. auto rfn = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(lumpnum)); auto rfbase = ExtractFileBase(rfn); FStringf aliasMusicname("music/%s/%s", rfbase.GetChars(), musicname); - lumpnum = LookupMusic(aliasMusicname); + int newlumpnum = LookupMusic(aliasMusicname); + if (newlumpnum >= 0) lumpnum = newlumpnum; } if (lumpnum == -1) { @@ -149,7 +150,7 @@ FileReader OpenMusic(const char* musicname) } if (lumpnum == -1 && (g_gameType & GAMEFLAG_SW)) { - // Some Shadow Warrioe distributions have the music in a subfolder named 'classic'. Check that, too. + // Some Shadow Warrior distributions have the music in a subfolder named 'classic'. Check that, too. FStringf aliasMusicname("classic/music/%s", musicname); lumpnum = fileSystem.FindFile(aliasMusicname); } From 51c4c47183350d5c7abd96b4ae19340739fdb265 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 8 Apr 2021 18:01:42 +0200 Subject: [PATCH 7/7] - block manual advancing of intermission screens when already fading out. This seems to cause some serious stability issues with how they handle the 2D drawer. --- source/core/screenjob.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/core/screenjob.cpp b/source/core/screenjob.cpp index 97413104e..943178a68 100644 --- a/source/core/screenjob.cpp +++ b/source/core/screenjob.cpp @@ -840,7 +840,7 @@ public: clock += now - lastTime; if (clock == 0) clock = 1; } - bool skiprequest = clock > 100'000'000 && inputState.CheckAllInput() && !processed; + bool skiprequest = clock > 100'000'000 && inputState.CheckAllInput() && !processed && job.job->fadestate != DScreenJob::fadeout; lastTime = now; if (screenfade < 1.f && !M_Active()) @@ -848,7 +848,8 @@ public: float ms = (clock / 1'000'000) / job.job->fadetime; screenfade = clamp(ms, 0.f, 1.f); twod->SetScreenFade(screenfade); - job.job->fadestate = DScreenJob::fadein; + if (job.job->fadestate != DScreenJob::fadeout) + job.job->fadestate = DScreenJob::fadein; } else {