-- Copyright (c) 1992 by M. Stephenson and Izchak Miller
-- NetHack may be freely redistributed. See license for details.
--
-des.level_init({ style = "solidfill", fg = " " });
-des.level_flags("mazelevel", "noteleport", "shortsighted")
+des.level_flags("mazelevel", "noteleport", "shortsighted", "noflip")
-- des.level_init(mines,'.','}',true,true,unlit,false)
-des.level_init({ style = "mines", fg = ".", bg = "}", smoothed=1, joined=1, lit=0 });
+des.level_init({ style = "swamp", lit = 0 });
-- guarantee at least one open spot to ensure successful stair placement
des.map({ halign = "left", valign = "bottom", map = [[
xxxxxxxx
des.object("boulder")
-- lair
des.map([[
-xx}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}xx
-x}}}.}}}}}..}}}..}}}}}..}}}..}}}}}..}}}..}}}}}.}}}x
-}}}...}}..}}.}.}}.}}.}}}...}}}.}}}..}}}..}}}}...}}}
-x}}}.}}.}}}.}}.}}.}}...}}.}}.....}}.....}....}.}}}x
-xx}}}..}}}.}}.}}.}}..}}.....}}.}}}.}}.}}}}}}}}}}}xx
-x}}}..}}}}}.}}.}}.}}...}}}}}.....}}.}}}}}}.....}}}x
-}}}..}}...}}..}}.}}}.}}}...}}}.}}}.}.}}}}..P.P..}}}
-}}.}}}}...}}}}}.}...}}}..P..}}}.}.}}}.}}}}.....}}}}
-}.}}}}.}}.}..}.}}}}}}}..P.P..}}}.}}}.}}..}}...}}}}x
-x}}}}.}}}}....}}}}}.}}}..P..}}}.}}}}.}}..}}...}}}.}
-}}}}..}}.}}..}}}}...}}}}...}}}.}}}}}.}}}}.}}}}}}.}}
-}}}...}}...}}}..}}}}}}}}}}}}.....}}}}.}}...}..}.}}}
-x}}}..}}.}}}}....}}..}}}..}}.....}}}}.}}}.}....}}}x
-xx}}}.}}}}..}}..}}..}}..}}..}}.}}}..}.}..}}}..}}}xx
-x}}}.}}}}....}}}}..}}....}}}}}}}...}}}....}}}}.}}}x
-}}}...}}}....}}}..}}}....}}}..}}...}}}....}}}...}}}
-x}}}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
-- Random registers
local monster = { "j","b","P","F" }
-- Dungeon description
des.region({ region={00,00,50,17}, lit=0, type="swamp" })
-des.mazewalk(00,09,"west")
-des.mazewalk(50,08,"east")
des.levregion({ region = {01,00,11,20}, region_islev=1, exclude={0,0,50,17}, type="stair-down" });
des.levregion({ region = {69,00,79,20}, region_islev=1, exclude={0,0,50,17}, type="stair-up" });
des.levregion({ region = {01,00,11,20}, region_islev=1, exclude={0,0,50,17}, type="branch" });
static void NDECL(solidify_map);
static void FDECL(lvlfill_maze_grid, (int, int, int, int, SCHAR_P));
static void FDECL(lvlfill_solid, (SCHAR_P, SCHAR_P));
+static void FDECL(lvlfill_swamp, (SCHAR_P, SCHAR_P, SCHAR_P));
static void FDECL(flip_drawbridge_horizontal, (struct rm *));
static void FDECL(flip_drawbridge_vertical, (struct rm *));
static int FDECL(flip_encoded_direction_bits, (int, int));
}
}
+static void
+lvlfill_swamp(fg, bg, lit)
+schar fg, bg, lit;
+{
+ int x,y;
+
+ lvlfill_solid(bg, lit);
+
+ /* "relaxed blockwise maze" algorithm, Jamis Buck */
+ for (x = 2; x <= g.x_maze_max; x+=2)
+ for (y = 0; y <= g.y_maze_max; y+=2) {
+ int c = 0;
+ SET_TYPLIT(x, y, fg, lit);
+ if (levl[x+1][y].typ == bg) c++;
+ if (levl[x][y+1].typ == bg) c++;
+ if (levl[x+1][y+1].typ == bg) c++;
+ if (c == 3) {
+ switch (rn2(3)) {
+ case 0: SET_TYPLIT((x+1),y, fg, lit); break;
+ case 1: SET_TYPLIT(x, (y+1), fg, lit); break;
+ case 2: SET_TYPLIT((x+1),(y+1), fg, lit); break;
+ default: break;
+ }
+ }
+ }
+}
+
static void
flip_drawbridge_horizontal(lev)
struct rm *lev;
linit->icedpools = icedpools;
mkmap(linit);
break;
+ case LVLINIT_SWAMP:
+ if (linit->lit == -1)
+ linit->lit = rn2(2);
+ lvlfill_swamp(linit->fg, linit->bg, linit->lit);
+ break;
}
}
lua_State *L;
{
static const char *const initstyles[] = {
- "solidfill", "mazegrid", "rogue", "mines", NULL
+ "solidfill", "mazegrid", "rogue", "mines", "swamp", NULL
};
static const int initstyles2i[] = {
- LVLINIT_SOLIDFILL, LVLINIT_MAZEGRID, LVLINIT_ROGUE, LVLINIT_MINES
+ LVLINIT_SOLIDFILL, LVLINIT_MAZEGRID, LVLINIT_ROGUE,
+ LVLINIT_MINES, LVLINIT_SWAMP, 0
};
lev_init init_lev;
init_lev.init_style
= initstyles2i[get_table_option(L, "style", "solidfill", initstyles)];
init_lev.fg = get_table_mapchr_opt(L, "fg", ROOM);
- init_lev.bg = get_table_mapchr_opt(L, "bg", STONE);
+ init_lev.bg = get_table_mapchr_opt(L, "bg", INVALID_TYPE);
init_lev.smoothed = get_table_boolean_opt(L, "smoothed", 0);
init_lev.joined = get_table_boolean_opt(L, "joined", 0);
init_lev.lit = get_table_int_or_random(L, "lit", -1); /* TODO: allow lit=BOOL */
g.coder->lvl_is_joined = init_lev.joined;
+ if (init_lev.bg == INVALID_TYPE)
+ init_lev.bg = (init_lev.init_style == LVLINIT_SWAMP) ? MOAT : STONE;
+
splev_initlev(&init_lev);
return 0;