Skip to content
Snippets Groups Projects
Commit f5a45534 authored by Sal's avatar Sal
Browse files

Make the texture stuff completely integer-based again, but expose R_TextureNumForName

Decided that being able to set a string and then have it return an integer when retrieving would ultimately be confusing, so let's just let the user handle the string functions.
parent ed1c1089
No related branches found
No related tags found
No related merge requests found
......@@ -1722,7 +1722,23 @@ static int lib_rSetPlayerSkin(lua_State *L)
// R_DATA
////////////
// This also doesn't exist, but we need it for texture find+replace to not be a horrible chore.
static int lib_rCheckTextureNumForName(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
//HUDSAFE
lua_pushinteger(L, R_CheckTextureNumForName(name));
return 1;
}
static int lib_rTextureNumForName(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
//HUDSAFE
lua_pushinteger(L, R_TextureNumForName(name));
return 1;
}
// This doesn't exist, but we need it for texture find+replace to not be a horrible chore.
static int lib_rGetTextureName(lua_State *L)
{
INT32 texnum = luaL_checkinteger(L, 1);
......@@ -2585,6 +2601,8 @@ static luaL_Reg lib[] = {
{"R_SetPlayerSkin",lib_rSetPlayerSkin},
// r_data
{"R_CheckTextureNumForName",lib_rCheckTextureNumForName),
{"R_TextureNumForName",lib_rTextureNumForName),
{"R_GetTextureName",lib_rGetTextureName},
// s_sound
......
......@@ -720,22 +720,13 @@ static int side_set(lua_State *L)
side->rowoffset = luaL_checkfixed(L, 3);
break;
case side_toptexture:
if (lua_isstring(L, 3))
side->toptexture = R_TextureNumForName(lua_tostring(L, 3));
else
side->toptexture = luaL_checkinteger(L, 3);
side->toptexture = luaL_checkinteger(L, 3);
break;
case side_bottomtexture:
if (lua_isstring(L, 3))
side->bottomtexture = R_TextureNumForName(lua_tostring(L, 3));
else
side->bottomtexture = luaL_checkinteger(L, 3);
side->bottomtexture = luaL_checkinteger(L, 3);
break;
case side_midtexture:
if (lua_isstring(L, 3))
side->midtexture = R_TextureNumForName(lua_tostring(L, 3));
else
side->midtexture = luaL_checkinteger(L, 3);
side->midtexture = luaL_checkinteger(L, 3);
break;
case side_repeatcnt:
side->repeatcnt = luaL_checkinteger(L, 3);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment