mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
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.
This commit is contained in:
parent
ed1c108992
commit
f5a45534fa
2 changed files with 22 additions and 13 deletions
|
@ -1722,7 +1722,23 @@ static int lib_rSetPlayerSkin(lua_State *L)
|
||||||
// R_DATA
|
// 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)
|
static int lib_rGetTextureName(lua_State *L)
|
||||||
{
|
{
|
||||||
INT32 texnum = luaL_checkinteger(L, 1);
|
INT32 texnum = luaL_checkinteger(L, 1);
|
||||||
|
@ -2585,6 +2601,8 @@ static luaL_Reg lib[] = {
|
||||||
{"R_SetPlayerSkin",lib_rSetPlayerSkin},
|
{"R_SetPlayerSkin",lib_rSetPlayerSkin},
|
||||||
|
|
||||||
// r_data
|
// r_data
|
||||||
|
{"R_CheckTextureNumForName",lib_rCheckTextureNumForName),
|
||||||
|
{"R_TextureNumForName",lib_rTextureNumForName),
|
||||||
{"R_GetTextureName",lib_rGetTextureName},
|
{"R_GetTextureName",lib_rGetTextureName},
|
||||||
|
|
||||||
// s_sound
|
// s_sound
|
||||||
|
|
|
@ -720,22 +720,13 @@ static int side_set(lua_State *L)
|
||||||
side->rowoffset = luaL_checkfixed(L, 3);
|
side->rowoffset = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
case side_toptexture:
|
case side_toptexture:
|
||||||
if (lua_isstring(L, 3))
|
side->toptexture = luaL_checkinteger(L, 3);
|
||||||
side->toptexture = R_TextureNumForName(lua_tostring(L, 3));
|
|
||||||
else
|
|
||||||
side->toptexture = luaL_checkinteger(L, 3);
|
|
||||||
break;
|
break;
|
||||||
case side_bottomtexture:
|
case side_bottomtexture:
|
||||||
if (lua_isstring(L, 3))
|
side->bottomtexture = luaL_checkinteger(L, 3);
|
||||||
side->bottomtexture = R_TextureNumForName(lua_tostring(L, 3));
|
|
||||||
else
|
|
||||||
side->bottomtexture = luaL_checkinteger(L, 3);
|
|
||||||
break;
|
break;
|
||||||
case side_midtexture:
|
case side_midtexture:
|
||||||
if (lua_isstring(L, 3))
|
side->midtexture = luaL_checkinteger(L, 3);
|
||||||
side->midtexture = R_TextureNumForName(lua_tostring(L, 3));
|
|
||||||
else
|
|
||||||
side->midtexture = luaL_checkinteger(L, 3);
|
|
||||||
break;
|
break;
|
||||||
case side_repeatcnt:
|
case side_repeatcnt:
|
||||||
side->repeatcnt = luaL_checkinteger(L, 3);
|
side->repeatcnt = luaL_checkinteger(L, 3);
|
||||||
|
|
Loading…
Reference in a new issue