Fix the Lua Linedef Flags conundrum
This commit is contained in:
parent
197be8cb00
commit
6a43aac0d5
4 changed files with 26 additions and 38 deletions
|
|
@ -362,37 +362,12 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word)
|
|||
}
|
||||
else if (fastncmp("ML_", word, 3)) {
|
||||
p = word+3;
|
||||
for (i = 0; i < 20; i++)
|
||||
if (ML_LIST[i] && fastcmp(p, ML_LIST[i])) {
|
||||
const char *const *list = lua_compatmode ? ML_LIST_KART : ML_LIST;
|
||||
for (i = 0; list[i]; i++)
|
||||
if (fastcmp(p, list[i])) {
|
||||
CacheAndPushConstant(L, word, ((lua_Integer)1<<i));
|
||||
return 1;
|
||||
}
|
||||
// Aliases
|
||||
if (fastcmp(p, "EFFECT1"))
|
||||
{
|
||||
lua_pushinteger(L, (lua_Integer)ML_SKEWTD);
|
||||
return 1;
|
||||
}
|
||||
if (fastcmp(p, "EFFECT2"))
|
||||
{
|
||||
lua_pushinteger(L, (lua_Integer)ML_NOSKEW);
|
||||
return 1;
|
||||
}
|
||||
if (fastcmp(p, "EFFECT3"))
|
||||
{
|
||||
lua_pushinteger(L, (lua_Integer)ML_MIDPEG);
|
||||
return 1;
|
||||
}
|
||||
if (fastcmp(p, "EFFECT4"))
|
||||
{
|
||||
lua_pushinteger(L, (lua_Integer)ML_MIDSOLID);
|
||||
return 1;
|
||||
}
|
||||
if (fastcmp(p, "EFFECT5"))
|
||||
{
|
||||
lua_pushinteger(L, (lua_Integer)ML_WRAPMIDTEX);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "linedef flag '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,14 +336,31 @@ const char *const ML_LIST[] = {
|
|||
"MIDPEG",
|
||||
"MIDSOLID",
|
||||
"WRAPMIDTEX",
|
||||
"NETONLY",
|
||||
"NONET",
|
||||
"EFFECT6",
|
||||
"NOTBOUNCY",
|
||||
"TFERLINE",
|
||||
NULL
|
||||
};
|
||||
|
||||
// Linedef flags for Kart
|
||||
const char *const ML_LIST_KART[] = {
|
||||
"IMPASSIBLE",
|
||||
"BLOCKMONSTERS",
|
||||
"TWOSIDED",
|
||||
"DONTPEGTOP",
|
||||
"DONTPEGBOTTOM",
|
||||
"EFFECT1",
|
||||
"NOCLIMB",
|
||||
"EFFECT2",
|
||||
"EFFECT3",
|
||||
"EFFECT4",
|
||||
"EFFECT5",
|
||||
"NOSONIC",
|
||||
"NOTAILS",
|
||||
"NOKNUX",
|
||||
"NETONLY",
|
||||
"NETONLY_OLD",
|
||||
"NONET",
|
||||
"BLOCKMONSTERS",
|
||||
"NOTBOUNCY",
|
||||
"BOUNCY",
|
||||
"TFERLINE",
|
||||
NULL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ extern const char *const PLAYERFLAG_LIST[];
|
|||
extern const char *const ITEMFLAG_LIST[];
|
||||
extern const char *const GAMETYPERULE_LIST[];
|
||||
extern const char *const ML_LIST[]; // Linedef flags
|
||||
extern const char *const ML_LIST_KART[]; // Linedef flags for Kart
|
||||
extern const char *const MSF_LIST[]; // Sector flags
|
||||
extern const char *const SSF_LIST[]; // Sector special flags
|
||||
extern const char *const SD_LIST[]; // Sector damagetype
|
||||
|
|
|
|||
|
|
@ -144,11 +144,6 @@ enum
|
|||
ML_MIDSOLID = 0x00000200,
|
||||
ML_WRAPMIDTEX = 0x00000400,
|
||||
|
||||
// Compat for old lua scripts.
|
||||
ML_NOSONIC = 0x00000800,
|
||||
ML_NOTAILS = 0x00001000,
|
||||
ML_NOKNUX = 0x00002000,
|
||||
|
||||
// Apply effect only in netgames
|
||||
ML_NETONLY = 0x00000800,
|
||||
ML_NETONLY_OLD = 0x00003800, // Combination of old ML_NOSONIC, ML_NOTAILS and ML_NOKNUX
|
||||
|
|
|
|||
Loading…
Reference in a new issue