add ESLOPE ifdef checks around all the Lua slope support code that was there before I was involved

This commit is contained in:
Monster Iestyn 2018-10-21 16:27:54 +01:00
parent bd0c187e68
commit e15ed742c1
3 changed files with 28 additions and 0 deletions

View File

@ -7261,11 +7261,13 @@ struct {
{"FF_COLORMAPONLY",FF_COLORMAPONLY}, ///< Only copy the colormap, not the lightlevel {"FF_COLORMAPONLY",FF_COLORMAPONLY}, ///< Only copy the colormap, not the lightlevel
{"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop. {"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop.
#ifdef ESLOPE
// Slope flags // Slope flags
{"SL_NOPHYSICS",SL_NOPHYSICS}, // Don't do momentum adjustment with this slope {"SL_NOPHYSICS",SL_NOPHYSICS}, // Don't do momentum adjustment with this slope
{"SL_NODYNAMIC",SL_NODYNAMIC}, // Slope will never need to move during the level, so don't fuss with recalculating it {"SL_NODYNAMIC",SL_NODYNAMIC}, // Slope will never need to move during the level, so don't fuss with recalculating it
{"SL_ANCHORVERTEX",SL_ANCHORVERTEX},// Slope is using a Slope Vertex Thing to anchor its position {"SL_ANCHORVERTEX",SL_ANCHORVERTEX},// Slope is using a Slope Vertex Thing to anchor its position
{"SL_VERTEXSLOPE",SL_VERTEXSLOPE}, // Slope is built from three Slope Vertex Things {"SL_VERTEXSLOPE",SL_VERTEXSLOPE}, // Slope is built from three Slope Vertex Things
#endif
// Angles // Angles
{"ANG1",ANG1}, {"ANG1",ANG1},

View File

@ -38,9 +38,11 @@ extern lua_State *gL;
#define META_SUBSECTOR "SUBSECTOR_T*" #define META_SUBSECTOR "SUBSECTOR_T*"
#define META_SECTOR "SECTOR_T*" #define META_SECTOR "SECTOR_T*"
#define META_FFLOOR "FFLOOR_T*" #define META_FFLOOR "FFLOOR_T*"
#ifdef ESLOPE
#define META_SLOPE "PSLOPE_T*" #define META_SLOPE "PSLOPE_T*"
#define META_VECTOR2 "VECTOR2_T" #define META_VECTOR2 "VECTOR2_T"
#define META_VECTOR3 "VECTOR3_T" #define META_VECTOR3 "VECTOR3_T"
#endif
#define META_MAPHEADER "MAPHEADER_T*" #define META_MAPHEADER "MAPHEADER_T*"
#define META_CVAR "CONSVAR_T*" #define META_CVAR "CONSVAR_T*"

View File

@ -40,10 +40,14 @@ enum sector_e {
sector_heightsec, sector_heightsec,
sector_camsec, sector_camsec,
sector_lines, sector_lines,
#ifdef ESLOPE
sector_ffloors, sector_ffloors,
sector_fslope, sector_fslope,
sector_cslope, sector_cslope,
sector_hasslope sector_hasslope
#else
sector_ffloors
#endif
}; };
static const char *const sector_opt[] = { static const char *const sector_opt[] = {
@ -60,9 +64,11 @@ static const char *const sector_opt[] = {
"camsec", "camsec",
"lines", "lines",
"ffloors", "ffloors",
#ifdef ESLOPE
"f_slope", "f_slope",
"c_slope", "c_slope",
"hasslope", "hasslope",
#endif
NULL}; NULL};
enum subsector_e { enum subsector_e {
@ -168,8 +174,10 @@ enum ffloor_e {
ffloor_toplightlevel, ffloor_toplightlevel,
ffloor_bottomheight, ffloor_bottomheight,
ffloor_bottompic, ffloor_bottompic,
#ifdef ESLOPE
ffloor_tslope, ffloor_tslope,
ffloor_bslope, ffloor_bslope,
#endif
ffloor_sector, ffloor_sector,
ffloor_flags, ffloor_flags,
ffloor_master, ffloor_master,
@ -186,8 +194,10 @@ static const char *const ffloor_opt[] = {
"toplightlevel", "toplightlevel",
"bottomheight", "bottomheight",
"bottompic", "bottompic",
#ifdef ESLOPE
"t_slope", "t_slope",
"b_slope", "b_slope",
#endif
"sector", // secnum pushed as control sector userdata "sector", // secnum pushed as control sector userdata
"flags", "flags",
"master", // control linedef "master", // control linedef
@ -197,6 +207,7 @@ static const char *const ffloor_opt[] = {
"alpha", "alpha",
NULL}; NULL};
#ifdef ESLOPE
enum slope_e { enum slope_e {
slope_valid = 0, slope_valid = 0,
slope_o, slope_o,
@ -235,6 +246,7 @@ static const char *const vector_opt[] = {
"y", "y",
"z", "z",
NULL}; NULL};
#endif
static const char *const array_opt[] ={"iterate",NULL}; static const char *const array_opt[] ={"iterate",NULL};
static const char *const valid_opt[] ={"valid",NULL}; static const char *const valid_opt[] ={"valid",NULL};
@ -450,6 +462,7 @@ static int sector_get(lua_State *L)
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR); LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function
return 1; return 1;
#ifdef ESLOPE
case sector_fslope: // f_slope case sector_fslope: // f_slope
LUA_PushUserdata(L, sector->f_slope, META_SLOPE); LUA_PushUserdata(L, sector->f_slope, META_SLOPE);
return 1; return 1;
@ -459,6 +472,7 @@ static int sector_get(lua_State *L)
case sector_hasslope: // hasslope case sector_hasslope: // hasslope
lua_pushboolean(L, sector->hasslope); lua_pushboolean(L, sector->hasslope);
return 1; return 1;
#endif
} }
return 0; return 0;
} }
@ -481,9 +495,11 @@ static int sector_set(lua_State *L)
case sector_heightsec: // heightsec case sector_heightsec: // heightsec
case sector_camsec: // camsec case sector_camsec: // camsec
case sector_ffloors: // ffloors case sector_ffloors: // ffloors
#ifdef ESLOPE
case sector_fslope: // f_slope case sector_fslope: // f_slope
case sector_cslope: // c_slope case sector_cslope: // c_slope
case sector_hasslope: // hasslope case sector_hasslope: // hasslope
#endif
default: default:
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]); return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
case sector_floorheight: { // floorheight case sector_floorheight: { // floorheight
@ -1118,12 +1134,14 @@ static int ffloor_get(lua_State *L)
lua_pushlstring(L, levelflat->name, 8); lua_pushlstring(L, levelflat->name, 8);
return 1; return 1;
} }
#ifdef ESLOPE
case ffloor_tslope: case ffloor_tslope:
LUA_PushUserdata(L, *ffloor->t_slope, META_SLOPE); LUA_PushUserdata(L, *ffloor->t_slope, META_SLOPE);
return 1; return 1;
case ffloor_bslope: case ffloor_bslope:
LUA_PushUserdata(L, *ffloor->b_slope, META_SLOPE); LUA_PushUserdata(L, *ffloor->b_slope, META_SLOPE);
return 1; return 1;
#endif
case ffloor_sector: case ffloor_sector:
LUA_PushUserdata(L, &sectors[ffloor->secnum], META_SECTOR); LUA_PushUserdata(L, &sectors[ffloor->secnum], META_SECTOR);
return 1; return 1;
@ -1163,8 +1181,10 @@ static int ffloor_set(lua_State *L)
switch(field) switch(field)
{ {
case ffloor_valid: // valid case ffloor_valid: // valid
#ifdef ESLOPE
case ffloor_tslope: // t_slope case ffloor_tslope: // t_slope
case ffloor_bslope: // b_slope case ffloor_bslope: // b_slope
#endif
case ffloor_sector: // sector case ffloor_sector: // sector
case ffloor_master: // master case ffloor_master: // master
case ffloor_target: // target case ffloor_target: // target
@ -1225,6 +1245,7 @@ static int ffloor_set(lua_State *L)
return 0; return 0;
} }
#ifdef ESLOPE
static int slope_get(lua_State *L) static int slope_get(lua_State *L)
{ {
pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE)); pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE));
@ -1391,6 +1412,7 @@ static int vector3_get(lua_State *L)
return 0; return 0;
} }
#endif
static int lib_getMapheaderinfo(lua_State *L) static int lib_getMapheaderinfo(lua_State *L)
{ {
@ -1568,6 +1590,7 @@ int LUA_MapLib(lua_State *L)
lua_setfield(L, -2, "__newindex"); lua_setfield(L, -2, "__newindex");
lua_pop(L, 1); lua_pop(L, 1);
#ifdef ESLOPE
luaL_newmetatable(L, META_SLOPE); luaL_newmetatable(L, META_SLOPE);
lua_pushcfunction(L, slope_get); lua_pushcfunction(L, slope_get);
lua_setfield(L, -2, "__index"); lua_setfield(L, -2, "__index");
@ -1585,6 +1608,7 @@ int LUA_MapLib(lua_State *L)
lua_pushcfunction(L, vector3_get); lua_pushcfunction(L, vector3_get);
lua_setfield(L, -2, "__index"); lua_setfield(L, -2, "__index");
lua_pop(L, 1); lua_pop(L, 1);
#endif
luaL_newmetatable(L, META_MAPHEADER); luaL_newmetatable(L, META_MAPHEADER);
lua_pushcfunction(L, mapheaderinfo_get); lua_pushcfunction(L, mapheaderinfo_get);