From b08fc74a3d23c1357e01a3ead7726cb1fa3c8dd9 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Mon, 25 Mar 2024 20:39:49 -0400 Subject: [PATCH] Fix small mistake in DynOS_Tex_Get --- data/dynos_mgr_tex.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data/dynos_mgr_tex.cpp b/data/dynos_mgr_tex.cpp index 7876e5f5..f16cf0cf 100644 --- a/data/dynos_mgr_tex.cpp +++ b/data/dynos_mgr_tex.cpp @@ -451,6 +451,10 @@ void DynOS_Tex_AddCustom(const SysPath &aFilename, const char *aTexName) { } } +static inline bool IsPowerOfTwo(int n) { + return (ceil(log2(n)) == floor(log2(n))); +} + bool DynOS_Tex_Get(const char* aTexName, struct TextureInfo* aOutTexInfo) { #define CONVERT_TEXINFO { \ /* translate bit size */ \ @@ -483,8 +487,8 @@ bool DynOS_Tex_Get(const char* aTexName, struct TextureInfo* aOutTexInfo) { return false; } // texture width or height is NPOT - if (!(_Data->mRawWidth > 0 && _Data->mRawWidth & (_Data->mRawWidth - 1) == 0) || - !(_Data->mRawHeight > 0 && _Data->mRawHeight & (_Data->mRawHeight - 1) == 0)) { + if ((_Data->mRawWidth > 0 && _Data->mRawWidth & (_Data->mRawWidth - 1) == 0) || + (_Data->mRawHeight > 0 && _Data->mRawHeight & (_Data->mRawHeight - 1) == 0)) { PrintError("Attempted to load tex file with non power of two width or height: %s", aTexName); PrintConsole(CONSOLE_MESSAGE_ERROR, "Attempted to load tex file with non power of two width or height: %s", aTexName); return false;