Add mapthing tag field (not used yet)

This commit is contained in:
MascaraSnake 2020-01-25 09:52:13 +01:00
parent 60cde39042
commit 261f049f6c
3 changed files with 9 additions and 0 deletions

View File

@ -203,6 +203,7 @@ typedef struct
UINT16 options;
INT16 z;
UINT8 extrainfo;
INT16 tag;
struct mobj_s *mobj;
} mapthing_t;

View File

@ -788,6 +788,8 @@ static int mapthing_get(lua_State *L)
number = mt->z;
else if(fastcmp(field,"extrainfo"))
number = mt->extrainfo;
else if(fastcmp(field,"tag"))
number = mt->tag;
else if(fastcmp(field,"mobj")) {
LUA_PushUserdata(L, mt->mobj, META_MOBJ);
return 1;
@ -830,6 +832,8 @@ static int mapthing_set(lua_State *L)
return luaL_error(L, "mapthing_t extrainfo set %d out of range (%d - %d)", extrainfo, 0, 15);
mt->extrainfo = (UINT8)extrainfo;
}
else if (fastcmp(field,"tag"))
mt->tag = (INT16)luaL_checkinteger(L, 3);
else if(fastcmp(field,"mobj"))
mt->mobj = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
else

View File

@ -1279,6 +1279,7 @@ static void P_LoadThings(UINT8 *data)
mt->type = READUINT16(data);
mt->options = READUINT16(data);
mt->extrainfo = (UINT8)(mt->type >> 12);
mt->tag = 0;
mt->type &= 4095;
@ -1498,6 +1499,8 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val)
static void ParseTextmapThingParameter(UINT32 i, char *param, char *val)
{
if (fastcmp(param, "id"))
mapthings[i].tag = atol(val);
if (fastcmp(param, "x"))
mapthings[i].x = atol(val);
else if (fastcmp(param, "y"))
@ -1690,6 +1693,7 @@ static void P_LoadTextmap(void)
mt->options = 0;
mt->z = 0;
mt->extrainfo = 0;
mt->tag = 0;
mt->mobj = NULL;
TextmapParse(mapthingsPos[i], i, ParseTextmapThingParameter);