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.
This commit is contained in:
NepDisk 2026-02-26 13:17:31 -05:00
parent 2e2862e79f
commit d1e28ff217
3 changed files with 5 additions and 4 deletions

View file

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

View file

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

View file

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