diff --git a/dat/Valkyrie.des b/dat/Valkyrie.des index 520a0f8ba..0dbd3bd05 100644 --- a/dat/Valkyrie.des +++ b/dat/Valkyrie.des @@ -11,7 +11,7 @@ # and receive your quest assignment. # MAZE: "Val-strt",' ' -FLAGS: noteleport,hardfloor +FLAGS: noteleport,hardfloor,icedpools GEOMETRY:center,center MAP IIIIIIPPPIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII @@ -90,7 +90,7 @@ MONSTER: ('H',"fire giant"),(10,16),hostile # MAZE: "Val-loca",' ' -FLAGS: hardfloor +FLAGS: hardfloor,icedpools INIT_MAP: mines, '.', 'I', true, true, lit, false GEOMETRY:center,center MAP @@ -176,6 +176,7 @@ MONSTER:'H',random,hostile # MAZE: "Val-goal", 'L' +FLAGS: icedpools INIT_MAP: mines, '.', 'L', true, true, lit, false GEOMETRY:center,center MAP @@ -266,6 +267,7 @@ MONSTER:'H',random,hostile # MAZE: "Val-fila" , 'I' +FLAGS: icedpools INIT_MAP: mines, '.', 'I', true, true, lit, false NOMAP # @@ -299,6 +301,7 @@ TRAP: random, random TRAP: random, random MAZE: "Val-filb" , 'L' +FLAGS: icedpools INIT_MAP: mines, '.', 'L', true, true, lit, false NOMAP # diff --git a/dat/sokoban.des b/dat/sokoban.des index c2394448f..343e895d6 100644 --- a/dat/sokoban.des +++ b/dat/sokoban.des @@ -35,7 +35,7 @@ ### Bottom (first) level of Sokoban ### MAZE:"soko4-1",' ' -FLAGS:noteleport,hardfloor,premapped +FLAGS:noteleport,hardfloor,premapped,solidify GEOMETRY:center,center #12345678901234567890123456789012345678901234567890 MAP @@ -98,7 +98,7 @@ OBJECT:'/',random MAZE:"soko4-2",' ' -FLAGS:noteleport,hardfloor,premapped +FLAGS:noteleport,hardfloor,premapped,solidify GEOMETRY:center,center #12345678901234567890123456789012345678901234567890 MAP @@ -163,7 +163,7 @@ OBJECT:'/',random ### Second level ### MAZE:"soko3-1",' ' -FLAGS:noteleport,premapped +FLAGS:noteleport,premapped,solidify GEOMETRY:center,center #12345678901234567890123456789012345678901234567890 MAP @@ -239,7 +239,7 @@ OBJECT:'/',random MAZE:"soko3-2",' ' -FLAGS:noteleport,premapped +FLAGS:noteleport,premapped,solidify GEOMETRY:center,center #12345678901234567890123456789012345678901234567890 MAP @@ -308,7 +308,7 @@ OBJECT:'/',random ### Third level ### MAZE:"soko2-1",' ' -FLAGS:noteleport,premapped +FLAGS:noteleport,premapped,solidify GEOMETRY:center,center #12345678901234567890123456789012345678901234567890 MAP @@ -373,7 +373,7 @@ OBJECT:'/',random MAZE:"soko2-2",' ' -FLAGS:noteleport,premapped +FLAGS:noteleport,premapped,solidify GEOMETRY:center,center #12345678901234567890123456789012345678901234567890 MAP @@ -440,7 +440,7 @@ OBJECT:'/',random ### Top (last) level of Sokoban ### MAZE:"soko1-1",' ' -FLAGS:noteleport,premapped +FLAGS:noteleport,premapped,solidify GEOMETRY:center,center #12345678901234567890123456789012345678901234567890 MAP @@ -538,7 +538,7 @@ ENGRAVING:$place[0],burn,"Elbereth" MAZE:"soko1-2",' ' -FLAGS:noteleport,premapped +FLAGS:noteleport,premapped,solidify GEOMETRY:center,center #12345678901234567890123456789012345678901234567890 MAP diff --git a/dat/tower.des b/dat/tower.des index b87f102f5..eeef1f46b 100644 --- a/dat/tower.des +++ b/dat/tower.des @@ -6,7 +6,7 @@ # # Upper stage of Vlad's tower MAZE:"tower1",' ' -FLAGS: noteleport,hardfloor +FLAGS: noteleport,hardfloor,solidify GEOMETRY:half-left,center MAP --- --- --- @@ -52,7 +52,7 @@ NON_DIGGABLE:(00,00,14,10) # Intermediate stage of Vlad's tower MAZE:"tower2",' ' -FLAGS: noteleport,hardfloor +FLAGS: noteleport,hardfloor,solidify GEOMETRY:half-left,center MAP --- --- --- @@ -95,7 +95,7 @@ NON_DIGGABLE:(00,00,14,10) # Bottom most stage of Vlad's tower MAZE:"tower3",' ' -FLAGS: noteleport,hardfloor +FLAGS: noteleport,hardfloor,solidify GEOMETRY:half-left,center MAP --- --- --- diff --git a/include/sp_lev.h b/include/sp_lev.h index f5905bac5..3d4d961c6 100644 --- a/include/sp_lev.h +++ b/include/sp_lev.h @@ -28,7 +28,8 @@ #define PREMAPPED 0x00000040L /* premapped level & sokoban rules */ #define SHROUD 0x00000080L #define GRAVEYARD 0x00000100L - +#define ICEDPOOLS 0x00000200L /* for ice locations: ICED_POOL vs ICED_MOAT */ +#define SOLIDIFY 0x00000400L /* outer areas are nondiggable & nonpasswall */ /* different level layout initializers */ #define LVLINIT_NONE 0 @@ -278,8 +279,8 @@ struct sp_frame { struct sp_coder { struct splevstack *stack; struct sp_frame *frame; - /*int allow_flips;*/ int premapped; + boolean solidify; struct mkroom *croom; struct mkroom *tmproomlist[MAX_NESTED_ROOMS+1]; boolean failed_room[MAX_NESTED_ROOMS+1]; @@ -331,7 +332,7 @@ typedef struct { char fg, bg; boolean smoothed, joined; xchar lit, walled; - boolean icedpools; /* for ice locations: ICED_POOL vs ICED_MOAT */ + boolean icedpools; } lev_init; typedef struct { diff --git a/src/sp_lev.c b/src/sp_lev.c index fa2aa8984..46334a4ab 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -60,7 +60,9 @@ extern struct engr *head_engr; extern int min_rx, max_rx, min_ry, max_ry; /* from mkmap.c */ +/* positions touched by level elements explicitly defined in the des-file */ static char SpLev_Map[COLNO][ROWNO]; + static aligntyp ralign[3] = { AM_CHAOTIC, AM_NEUTRAL, AM_LAWFUL }; static NEARDATA xchar xstart, ystart; static NEARDATA char xsize, ysize; @@ -78,6 +80,8 @@ struct mkroom * FDECL(build_room, (room *, struct mkroom *)); char *lev_message = 0; lev_region *lregions = 0; int num_lregions = 0; +boolean splev_init_present = FALSE; +boolean icedpools = FALSE; struct obj *container_obj[MAX_CONTAINMENT]; int container_idx = 0; @@ -86,6 +90,16 @@ struct monst *invent_carrying_monster = NULL; #define SPLEV_STACK_RESERVE 128 +void +solidify_map() +{ + xchar x, y; + for (x = 0; x < COLNO; x++) + for (y = 0; y < ROWNO; y++) + if (IS_STWALL(levl[x][y].typ) && !SpLev_Map[x][y]) + levl[x][y].wall_info |= (W_NONDIGGABLE|W_NONPASSWALL); +} + void splev_stack_init(st) struct splevstack *st; @@ -502,7 +516,7 @@ remove_boundary_syms() if (has_bounds) { for(x = 0; x < x_maze_max; x++) for(y = 0; y < y_maze_max; y++) - if ((levl[x][y].typ == CROSSWALL) && !SpLev_Map[x][y]) + if ((levl[x][y].typ == CROSSWALL) && SpLev_Map[x][y]) levl[x][y].typ = ROOM; } } @@ -1504,7 +1518,7 @@ struct mkroom *croom; if (o->corpsenm != NON_PM) { if (o->corpsenm == NON_PM - 1) set_corpsenm(otmp, rndmonnum()); - else set_corpsenm(otmp, o->corpsenm); + else set_corpsenm(otmp, o->corpsenm); } /* set_corpsenm() took care of egg hatch and corpse timers */ @@ -1603,11 +1617,14 @@ struct mkroom *croom; for (wastyp = otmp->corpsenm; i < 1000 ; i++, wastyp = rndmonnum()) { /* makemon without rndmonst() might create a group */ was = makemon(&mons[wastyp], 0, 0, MM_NOCOUNTBIRTH); - if (was && !resists_ston(was)) { + if (was) { + if (!resists_ston(was)) { (void) propagate(wastyp, TRUE, FALSE); break; + } + mongone(was); + was = NULL; } - mongone(was); } if (was) { set_corpsenm(otmp, wastyp); @@ -2166,7 +2183,7 @@ fill_empty_maze() for(x = 2; x < x_maze_max; x++) for(y = 0; y < y_maze_max; y++) - if(!SpLev_Map[x][y]) mapcount--; + if(SpLev_Map[x][y]) mapcount--; if ((mapcount > (int) (mapcountmax / 10))) { mapfact = (int) ((mapcount * 100L) / mapcountmax); @@ -2321,6 +2338,7 @@ lev_init *linit; case LVLINIT_MINES: if (linit->lit == -1) linit->lit = rn2(2); if (linit->filling > -1) lvlfill_solid(linit->filling, 0); + linit->icedpools = icedpools; mkmap(linit); break; } @@ -2796,6 +2814,8 @@ spo_level_flags(coder) if (flags & PREMAPPED) coder->premapped = TRUE; if (flags & SHROUD) level.flags.hero_memory = 0; if (flags & GRAVEYARD) level.flags.graveyard = 1; + if (flags & ICEDPOOLS) icedpools = TRUE; + if (flags & SOLIDIFY) coder->solidify = TRUE; opvar_free(flagdata); } @@ -2816,6 +2836,8 @@ spo_initlevel(coder) !OV_pop_i(filling) || !OV_pop_i(init_style)) return; + splev_init_present = TRUE; + init_lev.init_style = OV_i(init_style); init_lev.fg = OV_i(fg); init_lev.bg = OV_i(bg); @@ -2978,16 +3000,10 @@ spo_stair(coder) if (!OV_pop_i(up) || !OV_pop_c(coord)) return; - if (coder->croom) { - get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord)); - mkstairs(x,y,(char)OV_i(up), coder->croom); - SpLev_Map[x][y] = 1; - } else { - get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord)); - if ((badtrap = t_at(x,y)) != 0) deltrap(badtrap); - mkstairs(x, y, (char)OV_i(up), coder->croom); - SpLev_Map[x][y] = 1; - } + get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord)); + if ((badtrap = t_at(x,y)) != 0) deltrap(badtrap); + mkstairs(x, y, (char)OV_i(up), coder->croom); + SpLev_Map[x][y] = 1; opvar_free(coord); opvar_free(up); @@ -3647,7 +3663,7 @@ sel_set_door(dx,dy,arg) typ = D_CLOSED; } levl[x][y].doormask = typ; - /*SpLev_Map[x][y] = 1;*/ + SpLev_Map[x][y] = 1; /* Now the complicated part, list it with each subroom */ /* The dog move and mail daemon routines use this */ @@ -4166,7 +4182,7 @@ redo_maploc: break; case 1: switch((int) halign) { - case LEFT: xstart = 3; break; + case LEFT: xstart = splev_init_present ? 1 : 3; break; case H_LEFT: xstart = 2+((x_maze_max-2-xsize)/4); break; case CENTER: xstart = 2+((x_maze_max-2-xsize)/2); break; case H_RIGHT: xstart = 2+((x_maze_max-2-xsize)*3/4); break; @@ -4220,6 +4236,7 @@ redo_maploc: levl[x][y].horizontal = 0; levl[x][y].roomno = 0; levl[x][y].edge = 0; + SpLev_Map[x][y] = 1; /* * Set secret doors to closed (why not trapped too?). Set * the horizontal bit. @@ -4240,6 +4257,8 @@ redo_maploc: levl[x][y].horizontal = 1; else if(levl[x][y].typ == LAVAPOOL) levl[x][y].lit = 1; + else if (splev_init_present && levl[x][y].typ == ICE) + levl[x][y].icedpool = icedpools ? ICED_POOL : ICED_MOAT; } if (coder->lvl_is_joined) remove_rooms(xstart, ystart, xstart+xsize, ystart+ysize); @@ -4488,12 +4507,15 @@ sp_lev *lvl; coder->frame = frame_new(0); coder->stack = NULL; coder->premapped = FALSE; - /*coder->allow_flips = 3;*/ + coder->solidify = FALSE; coder->croom = NULL; coder->n_subroom = 1; coder->exit_script = FALSE; coder->lvl_is_joined = 0; + splev_init_present = FALSE; + icedpools = FALSE; + if (wizard) { char *met = nh_getenv("SPCODER_MAX_RUNTIME"); if (met && met[0] == '1') max_execution = (1<<30) - 1; @@ -5044,6 +5066,7 @@ next_opcode: count_features(); if (coder->premapped) sokoban_detect(); + if (coder->solidify) solidify_map(); if (coder->frame) { struct sp_frame *tmpframe; diff --git a/util/lev_comp.l b/util/lev_comp.l index b41397030..bba52c270 100644 --- a/util/lev_comp.l +++ b/util/lev_comp.l @@ -293,6 +293,8 @@ mazelevel { savetoken(yytext); yylval.i=MAZELEVEL; return FLAG_TYPE; } premapped { savetoken(yytext); yylval.i=PREMAPPED; return FLAG_TYPE; } shroud { savetoken(yytext); yylval.i=SHROUD; return FLAG_TYPE; } graveyard { savetoken(yytext); yylval.i=GRAVEYARD; return FLAG_TYPE; } +icedpools { savetoken(yytext); yylval.i=ICEDPOOLS; return FLAG_TYPE; } +solidify { savetoken(yytext); yylval.i=SOLIDIFY; return FLAG_TYPE; } [0-9]+d[0-9]+ { char *p = strchr(yytext, 'd'); savetoken(yytext); if (p) {