Merge branch 'master' into newrenderer2

This commit is contained in:
Christoph Oelckers 2021-04-08 18:52:54 +02:00
commit a530dfbe35
9 changed files with 21 additions and 11 deletions

View file

@ -296,6 +296,9 @@ std::unique_ptr<VulkanShader> 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";

View file

@ -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)

View file

@ -46,6 +46,7 @@
static bool mus_blocked;
static FString lastStartedMusic;
TArray<FString> 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);
}

View file

@ -6,6 +6,7 @@
typedef TMap<FName, FName> MusicAliasMap;
extern MusicAliasMap MusicAliases;
extern TArray<FString> specialmusic;
// Totally minimalistic interface - should be all the game modules need.
void Mus_InitMusic();

View file

@ -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);

View file

@ -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
{

View file

@ -65,7 +65,6 @@ inline DDukeActor* getSndActor(const void* source)
return source ? &hittype[((spritetype*)source) - sprite] : nullptr;
}
TArray<FString> specialmusic;
static FSoundID currentCommentarySound;
static DDukeActor* currentCommentarySprite; // todo: GC this once actors become objects

View file

@ -74,8 +74,6 @@ void S_ParseDeveloperCommentary();
void StopCommentary();
bool StartCommentary(int tag, DDukeActor* sprnum);
extern TArray<FString> specialmusic;
END_DUKE_NS

View file

@ -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;