diff --git a/src/common/filesystem/ancientzip.h b/src/common/filesystem/ancientzip.h index 3b1497e02..621505504 100644 --- a/src/common/filesystem/ancientzip.h +++ b/src/common/filesystem/ancientzip.h @@ -41,7 +41,7 @@ public: int Explode(unsigned char *out, unsigned int outsize, FileReader &in, unsigned int insize, int flags); }; -class CExplosionError : CRecoverableError +class CExplosionError : public CRecoverableError { public: CExplosionError(const char *message) : CRecoverableError(message) {} diff --git a/src/common/filesystem/filesystem.cpp b/src/common/filesystem/filesystem.cpp index 7fd559502..0ea4ac7a6 100644 --- a/src/common/filesystem/filesystem.cpp +++ b/src/common/filesystem/filesystem.cpp @@ -837,6 +837,7 @@ void FileSystem::InitHashChains (void) { unsigned int i, j; + NumEntries = FileInfo.Size(); Hashes.Resize(8 * NumEntries); // Mark all buckets as empty memset(Hashes.Data(), -1, Hashes.Size() * sizeof(Hashes[0])); @@ -1522,10 +1523,11 @@ const char *FileSystem::GetResourceFileFullName (int rfnum) const noexcept bool FileSystem::CreatePathlessCopy(const char *name, int id, int /*flags*/) { - FString name2, type2, path; + FString name2=name, type2, path; // The old code said 'filename' and ignored the path, this looked like a bug. - auto lump = FindFile(name); + FixPathSeperator(name2); + auto lump = FindFile(name2); if (lump < 0) return false; // Does not exist. auto oldlump = FileInfo[lump]; diff --git a/src/common/rendering/gl/gl_hwtexture.cpp b/src/common/rendering/gl/gl_hwtexture.cpp index 70c353082..0043a67b8 100644 --- a/src/common/rendering/gl/gl_hwtexture.cpp +++ b/src/common/rendering/gl/gl_hwtexture.cpp @@ -312,6 +312,7 @@ bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, i { glTextureBytes = 1; forcenofilter = true; + needmipmap = false; } int w = 0, h = 0; diff --git a/src/common/utility/cmdlib.h b/src/common/utility/cmdlib.h index 9c85aa05f..4c4468c98 100644 --- a/src/common/utility/cmdlib.h +++ b/src/common/utility/cmdlib.h @@ -99,5 +99,7 @@ inline void fillshort(void* buff, size_t count, uint16_t clear) } } +template inline constexpr T Sgn(const T& val) { return (val > 0) - (val < 0); } + #endif diff --git a/src/common/utility/m_fixed.h b/src/common/utility/m_fixed.h index 99115df6e..30209d635 100644 --- a/src/common/utility/m_fixed.h +++ b/src/common/utility/m_fixed.h @@ -7,8 +7,11 @@ __forceinline constexpr int32_t MulScale(int32_t a, int32_t b, int32_t shift) { return (int32_t)(((int64_t)a * b) >> shift); } +__forceinline constexpr double MulScaleF(double a, double b, int32_t shift) { return (a * b) * (1. / (uint32_t(1) << shift)); } __forceinline constexpr int32_t DMulScale(int32_t a, int32_t b, int32_t c, int32_t d, int32_t shift) { return (int32_t)(((int64_t)a * b + (int64_t)c * d) >> shift); } +__forceinline constexpr int32_t TMulScale(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, int32_t f, int32_t shift) { return (int32_t)(((int64_t)a * b + (int64_t)c * d + (int64_t)e * f) >> shift); } __forceinline constexpr int32_t DivScale(int32_t a, int32_t b, int shift) { return (int32_t)(((int64_t)a << shift) / b); } +__forceinline constexpr int64_t DivScaleL(int64_t a, int64_t b, int shift) { return ((a << shift) / b); } #include "xs_Float.h"