From d1e28ff2173ffe216fc2d72c8cb8d7782b2e09d1 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Thu, 26 Feb 2026 13:17:31 -0500 Subject: [PATCH] Don't do I_Error meme texture replacement Luas This is an issue that mostly affects hardcode, Lua authors don't have to worry about this. --- src/lua_baselib.c | 2 +- src/r_textures.c | 4 ++-- src/r_textures.h | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index f0bfaa535..d38d5d41d 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2605,7 +2605,7 @@ static int lib_rTextureNumForName(lua_State *L) { const char *name = luaL_checkstring(L, 1); //HUDSAFE - lua_pushinteger(L, R_TextureNumForName(name)); + lua_pushinteger(L, R_TextureNumForNameEx(name, true)); return 1; } diff --git a/src/r_textures.c b/src/r_textures.c index 4283a49e6..75fbb5d30 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -2035,7 +2035,7 @@ INT32 R_CheckTextureNumForName(const char *name, UINT8 type) // // Calls R_CheckTextureNumForName. Returns REDWALL if not found. // -INT32 R_TextureNumForName(const char *name) +INT32 R_TextureNumForNameEx(const char *name, boolean lua) { INT32 i = R_CheckTextureNumForName(name, TEXTURETYPE_TEXTURE); @@ -2053,7 +2053,7 @@ INT32 R_TextureNumForName(const char *name) if (redwall == -2) { redwall = R_CheckTextureNumForName(MISSING_TEXTURE, TEXTURETYPE_TEXTURE); - if (redwall <= 256) + if (redwall <= 256 && !lua) // see P_SetBinaryFOFAlpha I_Error(MISSING_TEXTURE " resolved to ID <= 256. Shit's fucked man"); } diff --git a/src/r_textures.h b/src/r_textures.h index 7ec605e37..f80f34f94 100644 --- a/src/r_textures.h +++ b/src/r_textures.h @@ -107,7 +107,8 @@ void R_CheckFlatLength(drawspandata_t* ds, size_t size); void R_UpdateTextureBrightmap(INT32 tx, INT32 bm); // Returns the texture number for the texture name. -INT32 R_TextureNumForName(const char *name); +INT32 R_TextureNumForNameEx(const char *name, boolean lua); +#define R_TextureNumForName(name) R_TextureNumForNameEx(name, false) INT32 R_CheckTextureNumForName(const char *name, UINT8 type); extern INT32 numtextures;