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"; 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 9ee2d1c72..b2c3f0aed 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; @@ -138,7 +139,8 @@ FileReader OpenMusic(const char* musicname) 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) { @@ -148,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); } 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/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); 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 { 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 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;