Debug flag allowing overwriting stairs
And using it in the movement tests, so running doesn't stop at stairs.
This commit is contained in:
@@ -204,6 +204,7 @@ struct instance_flags {
|
|||||||
boolean window_inited; /* true if init_nhwindows() completed */
|
boolean window_inited; /* true if init_nhwindows() completed */
|
||||||
boolean vision_inited; /* true if vision is ready */
|
boolean vision_inited; /* true if vision is ready */
|
||||||
boolean sanity_check; /* run sanity checks */
|
boolean sanity_check; /* run sanity checks */
|
||||||
|
boolean debug_overwrite_stairs; /* debug: allow overwriting stairs */
|
||||||
boolean debug_mongen; /* debug: prevent monster generation */
|
boolean debug_mongen; /* debug: prevent monster generation */
|
||||||
boolean debug_hunger; /* debug: prevent hunger */
|
boolean debug_hunger; /* debug: prevent hunger */
|
||||||
boolean mon_polycontrol; /* debug: control monster polymorphs */
|
boolean mon_polycontrol; /* debug: control monster polymorphs */
|
||||||
|
|||||||
@@ -196,11 +196,14 @@ struct mapfragment {
|
|||||||
char *data;
|
char *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define CAN_OVERWRITE_TERRAIN(ttyp) \
|
||||||
|
(iflags.debug_overwrite_stairs || !((ttyp) == LADDER || (ttyp) == STAIRS))
|
||||||
|
|
||||||
#define SET_TYPLIT(x, y, ttyp, llit) \
|
#define SET_TYPLIT(x, y, ttyp, llit) \
|
||||||
do { \
|
do { \
|
||||||
if ((x) >= 1 && (y) >= 0 && (x) < COLNO && (y) < ROWNO) { \
|
if ((x) >= 1 && (y) >= 0 && (x) < COLNO && (y) < ROWNO) { \
|
||||||
if ((ttyp) < MAX_TYPE && levl[(x)][(y)].typ != STAIRS \
|
if ((ttyp) < MAX_TYPE \
|
||||||
&& levl[(x)][(y)].typ != LADDER) \
|
&& CAN_OVERWRITE_TERRAIN(levl[(x)][(y)].typ)) \
|
||||||
levl[(x)][(y)].typ = (ttyp); \
|
levl[(x)][(y)].typ = (ttyp); \
|
||||||
if ((ttyp) == LAVAPOOL) \
|
if ((ttyp) == LAVAPOOL) \
|
||||||
levl[(x)][(y)].lit = 1; \
|
levl[(x)][(y)].lit = 1; \
|
||||||
|
|||||||
10
src/nhlua.c
10
src/nhlua.c
@@ -974,7 +974,9 @@ nhl_doturn(lua_State *L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set debugging flags. debugging use only, of course. */
|
/* set debugging flags. debugging use only, of course. */
|
||||||
/* nh.debug_flags({ mongen = false, hunger = false }); */
|
/* nh.debug_flags({ mongen = false,
|
||||||
|
hunger = false,
|
||||||
|
overwrite_stairs = true }); */
|
||||||
static int
|
static int
|
||||||
nhl_debug_flags(lua_State *L)
|
nhl_debug_flags(lua_State *L)
|
||||||
{
|
{
|
||||||
@@ -1004,6 +1006,12 @@ nhl_debug_flags(lua_State *L)
|
|||||||
iflags.debug_hunger = !(boolean)val; /* value in lua is negated */
|
iflags.debug_hunger = !(boolean)val; /* value in lua is negated */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* allow overwriting stairs */
|
||||||
|
val = get_table_boolean_opt(L, "overwrite_stairs", -1);
|
||||||
|
if (val != -1) {
|
||||||
|
iflags.debug_overwrite_stairs = (boolean)val;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2338,7 +2338,7 @@ create_altar(altar* a, struct mkroom* croom)
|
|||||||
|
|
||||||
/* check for existing features */
|
/* check for existing features */
|
||||||
oldtyp = levl[x][y].typ;
|
oldtyp = levl[x][y].typ;
|
||||||
if (oldtyp == STAIRS || oldtyp == LADDER)
|
if (!CAN_OVERWRITE_TERRAIN(oldtyp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
amask = sp_amask_to_amask(a->sp_amask);
|
amask = sp_amask_to_amask(a->sp_amask);
|
||||||
|
|||||||
@@ -13,12 +13,15 @@ local POS = { x = 10, y = 05 };
|
|||||||
local number_pad = 0;
|
local number_pad = 0;
|
||||||
|
|
||||||
function initlev()
|
function initlev()
|
||||||
nh.debug_flags({mongen = false, hunger = false });
|
nh.debug_flags({mongen = false, hunger = false, overwrite_stairs = true });
|
||||||
des.level_flags("noflip");
|
des.level_flags("noflip");
|
||||||
des.reset_level();
|
des.reset_level();
|
||||||
des.level_init({ style = "solidfill", fg = ".", lit = true });
|
des.level_init({ style = "solidfill", fg = ".", lit = true });
|
||||||
des.teleport_region({ region = {POS.x,POS.y,POS.x,POS.y}, region_islev = true, dir="both" });
|
des.teleport_region({ region = {POS.x,POS.y,POS.x,POS.y}, region_islev = true, dir="both" });
|
||||||
des.finalize_level();
|
des.finalize_level();
|
||||||
|
for k, v in pairs(nh.stairways()) do
|
||||||
|
des.terrain(v.x - 1, v.y, ".");
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ctrl(key)
|
function ctrl(key)
|
||||||
|
|||||||
Reference in New Issue
Block a user