From e15ed742c124f556ebebd4983e9f09136fa7cca3 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 21 Oct 2018 16:27:54 +0100 Subject: [PATCH] add ESLOPE ifdef checks around all the Lua slope support code that was there before I was involved --- src/dehacked.c | 2 ++ src/lua_libs.h | 2 ++ src/lua_maplib.c | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 251b0532a..d470c7fa9 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7261,11 +7261,13 @@ struct { {"FF_COLORMAPONLY",FF_COLORMAPONLY}, ///< Only copy the colormap, not the lightlevel {"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop. +#ifdef ESLOPE // Slope flags {"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_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 +#endif // Angles {"ANG1",ANG1}, diff --git a/src/lua_libs.h b/src/lua_libs.h index a9c82bce2..15d988ef6 100644 --- a/src/lua_libs.h +++ b/src/lua_libs.h @@ -38,9 +38,11 @@ extern lua_State *gL; #define META_SUBSECTOR "SUBSECTOR_T*" #define META_SECTOR "SECTOR_T*" #define META_FFLOOR "FFLOOR_T*" +#ifdef ESLOPE #define META_SLOPE "PSLOPE_T*" #define META_VECTOR2 "VECTOR2_T" #define META_VECTOR3 "VECTOR3_T" +#endif #define META_MAPHEADER "MAPHEADER_T*" #define META_CVAR "CONSVAR_T*" diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 7635ded1c..d83634291 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -40,10 +40,14 @@ enum sector_e { sector_heightsec, sector_camsec, sector_lines, +#ifdef ESLOPE sector_ffloors, sector_fslope, sector_cslope, sector_hasslope +#else + sector_ffloors +#endif }; static const char *const sector_opt[] = { @@ -60,9 +64,11 @@ static const char *const sector_opt[] = { "camsec", "lines", "ffloors", +#ifdef ESLOPE "f_slope", "c_slope", "hasslope", +#endif NULL}; enum subsector_e { @@ -168,8 +174,10 @@ enum ffloor_e { ffloor_toplightlevel, ffloor_bottomheight, ffloor_bottompic, +#ifdef ESLOPE ffloor_tslope, ffloor_bslope, +#endif ffloor_sector, ffloor_flags, ffloor_master, @@ -186,8 +194,10 @@ static const char *const ffloor_opt[] = { "toplightlevel", "bottomheight", "bottompic", +#ifdef ESLOPE "t_slope", "b_slope", +#endif "sector", // secnum pushed as control sector userdata "flags", "master", // control linedef @@ -197,6 +207,7 @@ static const char *const ffloor_opt[] = { "alpha", NULL}; +#ifdef ESLOPE enum slope_e { slope_valid = 0, slope_o, @@ -235,6 +246,7 @@ static const char *const vector_opt[] = { "y", "z", NULL}; +#endif static const char *const array_opt[] ={"iterate",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_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function return 1; +#ifdef ESLOPE case sector_fslope: // f_slope LUA_PushUserdata(L, sector->f_slope, META_SLOPE); return 1; @@ -459,6 +472,7 @@ static int sector_get(lua_State *L) case sector_hasslope: // hasslope lua_pushboolean(L, sector->hasslope); return 1; +#endif } return 0; } @@ -481,9 +495,11 @@ static int sector_set(lua_State *L) case sector_heightsec: // heightsec case sector_camsec: // camsec case sector_ffloors: // ffloors +#ifdef ESLOPE case sector_fslope: // f_slope case sector_cslope: // c_slope case sector_hasslope: // hasslope +#endif default: return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]); case sector_floorheight: { // floorheight @@ -1118,12 +1134,14 @@ static int ffloor_get(lua_State *L) lua_pushlstring(L, levelflat->name, 8); return 1; } +#ifdef ESLOPE case ffloor_tslope: LUA_PushUserdata(L, *ffloor->t_slope, META_SLOPE); return 1; case ffloor_bslope: LUA_PushUserdata(L, *ffloor->b_slope, META_SLOPE); return 1; +#endif case ffloor_sector: LUA_PushUserdata(L, §ors[ffloor->secnum], META_SECTOR); return 1; @@ -1163,8 +1181,10 @@ static int ffloor_set(lua_State *L) switch(field) { case ffloor_valid: // valid +#ifdef ESLOPE case ffloor_tslope: // t_slope case ffloor_bslope: // b_slope +#endif case ffloor_sector: // sector case ffloor_master: // master case ffloor_target: // target @@ -1225,6 +1245,7 @@ static int ffloor_set(lua_State *L) return 0; } +#ifdef ESLOPE static int slope_get(lua_State *L) { pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE)); @@ -1391,6 +1412,7 @@ static int vector3_get(lua_State *L) return 0; } +#endif static int lib_getMapheaderinfo(lua_State *L) { @@ -1568,6 +1590,7 @@ int LUA_MapLib(lua_State *L) lua_setfield(L, -2, "__newindex"); lua_pop(L, 1); +#ifdef ESLOPE luaL_newmetatable(L, META_SLOPE); lua_pushcfunction(L, slope_get); lua_setfield(L, -2, "__index"); @@ -1585,6 +1608,7 @@ int LUA_MapLib(lua_State *L) lua_pushcfunction(L, vector3_get); lua_setfield(L, -2, "__index"); lua_pop(L, 1); +#endif luaL_newmetatable(L, META_MAPHEADER); lua_pushcfunction(L, mapheaderinfo_get);