More interesting Gehennom levels

Instead of just plain old boring mazes, spice up Gehennom by
occasionally adding lava, iron bars, or even mines-style levels
(with lava, of course).

Of the fixed Gehennom levels, only Asmodeus' lair has been changed
to add some random lava pools.

Also some lua fixes and changes:
- Fixed a selection negation bounding box being wrong.
- Fixed a selection negated and ORed returning wrong results.
- des.map now returns a selection of the map grids it touched.
- When using des.map contents-function the commands following the
  map are not relative to it.
This commit is contained in:
Pasi Kallinen
2023-01-09 22:25:23 +02:00
parent 7c72c1f141
commit 4af086be73
13 changed files with 310 additions and 65 deletions

View File

@@ -8,7 +8,6 @@
struct selectionvar *l_selection_check(lua_State *, int);
static struct selectionvar *l_selection_push_new(lua_State *);
static void l_selection_push_copy(lua_State *, struct selectionvar *);
/* lua_CFunction prototypes */
static int l_selection_new(lua_State *);
@@ -106,7 +105,7 @@ l_selection_push_new(lua_State *L)
}
/* push a copy of selectionvar tmp to lua stack */
static void
void
l_selection_push_copy(lua_State *L, struct selectionvar *tmp)
{
struct selectionvar
@@ -247,6 +246,7 @@ l_selection_not(lua_State *L)
(void) l_selection_clone(L);
sel2 = l_selection_check(L, 2);
selection_not(sel2);
lua_remove(L, 1);
}
return 1;
}

View File

@@ -4600,12 +4600,12 @@ struct selectionvar *
selection_not(struct selectionvar* s)
{
int x, y;
NhRect tmprect;
for (x = 0; x < s->wid; x++)
for (y = 0; y < s->hei; y++)
selection_setpoint(x, y, s, selection_getpoint(x, y, s) ? 0 : 1);
selection_getbounds(s, &tmprect);
return s;
}
@@ -6466,6 +6466,7 @@ DISABLE_WARNING_UNREACHABLE_CODE
/* map({ halign = "center", valign = "center", map = [[...]] }); */
/* map({ map = [[...]], contents = function(map) ... end }); */
/* map([[...]]) */
/* local selection = map( ... ); */
int
lspo_map(lua_State *L)
{
@@ -6493,6 +6494,7 @@ TODO: gc.coder->croom needs to be updated
boolean has_contents = FALSE;
int tryct = 0;
int ox, oy;
struct selectionvar *sel;
create_des_coder();
@@ -6527,6 +6529,7 @@ TODO: gc.coder->croom needs to be updated
return 0;
}
sel = selection_new();
ox = x;
oy = y;
redo_maploc:
@@ -6575,6 +6578,7 @@ TODO: gc.coder->croom needs to be updated
} else {
mapfrag_free(&mf);
nhl_error(L, "Map requires either x,y or halign,valign params");
selection_free(sel, TRUE);
return 0;
}
} else {
@@ -6671,6 +6675,7 @@ TODO: gc.coder->croom needs to be updated
}
if (mptyp >= MAX_TYPE)
continue;
selection_setpoint(x, y, sel, 1);
levl[x][y].typ = mptyp;
levl[x][y].lit = FALSE;
/* clear out levl: load_common_data may set them */
@@ -6712,9 +6717,14 @@ TODO: gc.coder->croom needs to be updated
if (nhl_pcall(L, 1, 0)){
impossible("Lua error: %s", lua_tostring(L, -1));
}
reset_xystart_size();
}
return 0;
/* return selection where map locations were put */
l_selection_push_copy(L, sel);
selection_free(sel, TRUE);
return 1;
}
RESTORE_WARNING_UNREACHABLE_CODE