diff --git a/src/doomdata.h b/src/doomdata.h index f6e7cb584..3ac3a9530 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -203,6 +203,7 @@ typedef struct UINT16 options; INT16 z; UINT8 extrainfo; + INT16 tag; struct mobj_s *mobj; } mapthing_t; diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 90733b2c6..fb6486c6c 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -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 diff --git a/src/p_setup.c b/src/p_setup.c index 3768bd47c..04d02fe46 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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);