mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-04-19 16:51:53 +00:00
Merge branch 'mobjinfo_string' into 'next'
Port mobjinfo.string from ring racers. See merge request STJr/SRB2!2444
This commit is contained in:
commit
5ae8e457e7
1 changed files with 19 additions and 0 deletions
|
@ -1158,6 +1158,7 @@ enum mobjinfo_e
|
|||
mobjinfo_activesound,
|
||||
mobjinfo_flags,
|
||||
mobjinfo_raisestate,
|
||||
mobjinfo_string,
|
||||
};
|
||||
|
||||
const char *const mobjinfo_opt[] = {
|
||||
|
@ -1185,6 +1186,7 @@ const char *const mobjinfo_opt[] = {
|
|||
"activesound",
|
||||
"flags",
|
||||
"raisestate",
|
||||
"string",
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
@ -1199,6 +1201,8 @@ static int mobjinfo_get(lua_State *L)
|
|||
I_Assert(info != NULL);
|
||||
I_Assert(info >= mobjinfo);
|
||||
|
||||
mobjtype_t id = info-mobjinfo;
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case mobjinfo_doomednum:
|
||||
|
@ -1273,6 +1277,21 @@ static int mobjinfo_get(lua_State *L)
|
|||
case mobjinfo_raisestate:
|
||||
lua_pushinteger(L, info->raisestate);
|
||||
break;
|
||||
case mobjinfo_string:
|
||||
if (id < MT_FIRSTFREESLOT)
|
||||
{
|
||||
lua_pushstring(L, MOBJTYPE_LIST[id]+3);
|
||||
return 1;
|
||||
}
|
||||
|
||||
id -= MT_FIRSTFREESLOT;
|
||||
if (id < NUMMOBJFREESLOTS && FREE_MOBJS[id])
|
||||
{
|
||||
lua_pushstring(L, FREE_MOBJS[id]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
default:
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
|
|
Loading…
Reference in a new issue