Add new level init type, swamp
Creates a "relaxed blockwise maze". Make Juiblex's swamp use it.
This commit is contained in:
@@ -3,11 +3,10 @@
|
||||
-- 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
|
||||
@@ -27,24 +26,24 @@ 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}}}.}}}}}..}}}..}}}}}..}}}..}}}}}..}}}..}}}}}.}}}x
|
||||
xx}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}xx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxx
|
||||
xxx...xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxx
|
||||
xxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxx}}}xxxxxxxxxxxxxxx}}}}}xxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxx}}}}}xxxxxxxxxxxxx}.....}xxx
|
||||
xxxxxxxxxxxxxxxxxxxxxx}}...}}xxxxxxxxxxx}..P.P..}xx
|
||||
xxxxxxxxxxxxxxxxxxxxx}}..P..}}xxxxxxxxxxx}.....}xxx
|
||||
xxxxxxxxxxxxxxxxxxxxx}}.P.P.}}xxxxxxxxxxxx}...}xxxx
|
||||
xxxxxxxxxxxxxxxxxxxxx}}..P..}}xxxxxxxxxxxx}...}xxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxx}}...}}xxxxxxxxxxxxxx}}}xxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxx}}}}}xxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxx}}}xxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxx
|
||||
xxx...xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxx
|
||||
xxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxx
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
]]);
|
||||
-- Random registers
|
||||
local monster = { "j","b","P","F" }
|
||||
@@ -58,8 +57,6 @@ place:set(46,15);
|
||||
|
||||
-- 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" });
|
||||
|
||||
@@ -164,6 +164,7 @@ added several new status conditions all of which are opt-in except
|
||||
the new cond_grab and cond_lava which are opt-out
|
||||
tipping your cap might get a response
|
||||
special levels can be flipped horizontally and/or vertically
|
||||
new special level initialization routine, "swamp"
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific New Features
|
||||
|
||||
@@ -39,7 +39,8 @@ enum lvlinit_types {
|
||||
LVLINIT_SOLIDFILL,
|
||||
LVLINIT_MAZEGRID,
|
||||
LVLINIT_MINES,
|
||||
LVLINIT_ROGUE
|
||||
LVLINIT_ROGUE,
|
||||
LVLINIT_SWAMP
|
||||
};
|
||||
|
||||
/* max. nested depth of subrooms */
|
||||
|
||||
43
src/sp_lev.c
43
src/sp_lev.c
@@ -27,6 +27,7 @@ static void NDECL(create_des_coder);
|
||||
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));
|
||||
@@ -215,6 +216,33 @@ schar lit;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -2666,6 +2694,11 @@ lev_init *linit;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3302,10 +3335,11 @@ lspo_level_init(L)
|
||||
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;
|
||||
|
||||
@@ -3318,7 +3352,7 @@ lua_State *L;
|
||||
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 */
|
||||
@@ -3327,6 +3361,9 @@ lua_State *L;
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user